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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.