2 + 2 = 5 Should Be Red

Client-side Dart code must be tested in a running Dart-enabled browser or headless context. A simple web page is required to host the test output. Any old HTML will suffice as long as it does the following:

  • Pulls in the Dart tests

  • Starts the Dart engine

The dummy test page for testing the HipsterCollection class will be as follows:

testing/test/01.html
 
<html>
 
<head>
 
<title>​Hipster Test Suite​</title>
 
<script​ type=​"application/dart"
 
src=​"HipsterCollectionTest.dart"​​>​​</script>
 
<script​ type=​"text/javascript"​​>
 
navigator.webkitStartDart(); // start Dart
 
</script>
 
</head>
 
 
<body>
 
<h1>​Test!​</h1>
 
</body>
 
</html>

We rely on HipsterCollectionTest.dart to import two required ...

Get Dart 1 for Everyone now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.