Obtaining the Test Harness

The unittest library is maintained by the core Dart team, but it is not part of the Dart SDK. Instead, it is hosted on the Dart Pub—the package repository for Dart. The easiest way to install this is to create a pubspec.yaml in the application root directory with contents like the following:

testing/pubspec.yaml
 
name: ​Dart Comics
 
dev_dependencies:
 
unittest: ​any

The “any” in there refers to any version of the unittest library, which will default to the most recent version. Since unit testing is not needed for the code to run, it is entered as a dev_dependency instead of a regular dependency.

To install package dependencies, run the pub install command from the command line or from the Tools menu of the Dart Editor. By convention, our tests will reside in the test subdirectory of our application.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.30.236