Dart Unit Testing

33 %
67 %
Information about Dart Unit Testing
Technology

Published on March 3, 2014

Author: MattNorris3

Source: slideshare.net

Description

Talk given at Google Developer Group NYC in February 2014 on Dart unit testing.

Dart Unit Testing Matt Norris @MattNorrisMe

What will we cover? Client tests Server tests

Why test?

I must have put a decimal point in the wrong place. I always mess up some mundane detail!

Client tests

HTML unit test test_index.dart import 'package:unittest/unittest.dart'; import 'package:unittest/html_enhanced_config.dart'; ... main() { useHtmlEnhancedConfiguration(); test("url includes scheme", () { expect(isValidUrl(“www.dartlang.org”), false); expect(isValidUrl(“http://www.dartlang.org”), true); });

HTML unit test test_index.dart import 'package:unittest/unittest.dart'; import 'package:unittest/html_enhanced_config.dart'; ... main() { useHtmlEnhancedConfiguration(); test("url includes scheme", () { expect(isValidUrl(“www.dartlang.org”), false); expect(isValidUrl(“http://www.dartlang.org”), true); });

HTML unit test test_index.dart import 'package:unittest/unittest.dart'; import 'package:unittest/html_enhanced_config.dart'; ... main() { useHtmlEnhancedConfiguration(); test("url includes scheme", () { expect(isValidUrl(“www.dartlang.org”), false); expect(isValidUrl(“http://www.dartlang.org”), true); });

HTML unit test

Headless HTML unit test $ content_shell --dump-render-tree web/test_index.html Content-Type: text/plain PASS All 2 tests passed Collapse All

Server

server.dart void main() { ... app.post("/").listen((request) { String url = request.param('url'); String hash = toHash(url); client.set(hash, url).then((_)=>request.response.json(hash);); }); ...

Server tests

server_tests.dart import 'package:unittest/unittest.dart'; import 'package:unittest/vm_config.dart'; import 'server.dart' as server; void main() { useVMConfiguration(); String URL = 'http://www.meetup.com/gdg-silicon-valley’; test('HashURL', () { expect(server.toHash(URL), isNotNull); expect(server.toHash(URL), '287b6d95'); ...

server_tests.dart import 'package:unittest/unittest.dart'; import 'package:unittest/vm_config.dart'; import 'server.dart' as server; void main() { useVMConfiguration(); String URL = 'http://www.meetup.com/gdg-silicon-valley’; test('HashURL', () { expect(server.toHash(URL), isNotNull); expect(server.toHash(URL), '287b6d95'); ...

server_tests.dart import 'package:unittest/unittest.dart'; import 'package:unittest/vm_config.dart'; import 'server.dart' as server; void main() { useVMConfiguration(); String URL = 'http://www.meetup.com/gdg-silicon-valley’; test('HashURL', () { expect(server.toHash(URL), isNotNull); expect(server.toHash(URL), '287b6d95'); ...

VM unit tests $ dart server_tests.dart PASS: HashURL

What did we cover? Client tests Server tests

What should you do? Try Dart Test things Deploy!

Such reference... much testing Project github.com/mattnorris/dart-url-shortener Original talk youtu.be/22pE1IP-yoY Continuous Integration in the Cloud drone.io

Thank you! Questions?

Add a comment

Related presentations

Related pages

test 0.12.15+3 | Pub Package Manager - Dart

test - A library for writing dart unit tests. ... test provides a standard way of writing and running tests in Dart. Writing Tests
Read more

Concolic testing - Wikipedia, the free encyclopedia

Concolic testing (a portmanteau of concrete and symbolic) is a hybrid software verification technique that performs symbolic execution, a classical ...
Read more

DART: Directed Automated Random Testing

DART: Directed Automated Random Testing Patrice Godefroid Nils Klarlund Bell Laboratories, Lucent Technologies {god,klarlund}@bell-labs.com Koushik Sen
Read more

dart unittest - YouTube

dart unittest alessio palma ... Unit testing ทำความรู้จัก Unit Testing อธิบาย ... Dart Html Unit Test - Dart ...
Read more

What is the best way to write unit-tests in Dart? - Stack ...

Dart doesn't seem to have a dedicated unit-testing framework yet. What is the best approach to write and run unit-tests? There are some very low-level ...
Read more

Holy Cow, Dart Unit Tests are Easy - Seth Ladd

Dart provides a rich unit test library out of the box. Inspired by testing libraries like Hamcrest and dartmatch, the dart:unittest library provides test ...
Read more

DART: Directed Automated Random Testing

PLDI’2005 Page 1 June 2005 DART: Directed Automated Random Testing Patrice Godefroid Nils Klarlund Koushik Sen Bell Labs Bell Labs UIUC
Read more

Dart (programming language) - Wikipedia, the free encyclopedia

Dart was unveiled at the ... Running in checked mode is recommended for development and testing. Dart ... Dart makes use of isolates as a concurrency and ...
Read more

Liste von Modultest-Software – Wikipedia

CUTE: ein simples, erweiterbares C++ Unit Testing Framework mit einem an JUnit angelehnten Plugin für Eclipse CDT. CxxTest, ... Dart Unittest ist bei Dart ...
Read more

Newest 'dart-unittest' Questions - Stack Overflow

A library for writing dart unit tests. learn more … | top users | synonyms. 2 ...
Read more