Skip to content
adam edited this page Jan 3, 2014 · 2 revisions

Introduction

Project has two types of unit tests. One collection of testing is for the generation tool, the other collection is for the generated apis. The generated apis can be tested with dartium, canary or chrome on mac currently. They could be tested on other operating systems but the bin script don't support that just yet. The tests for the generated apis are chrome packaged apps. There are two types of chrome packaged apps tests, apps and extensions. Both type of packaged apps test are in the app directory. The packaged apps need a minor configuration to function as a packaged app.

Testing Generated APIs

The ./bin/setup_app.dart script is used to copy the packages folder without symlinks into the projects in the ./app/ directory. Usage dart setup_app.dart [options] <DIRECTORY> <MAIN>. Once an app is configured the bin/load_app.sh script can be used to launch the packaged app in the chrome browser of choice. Usage ./bin/load_app.sh [chrome|canary|dartium] [app/extension directory].

  • app/test_app are unit tests for chrome packaged apps
  • app/test_ext are unit tests for chrome packaged extensions

Setting up test_app

dart setup_app.dart app/test_app

Will build the app/test_app with dart2js and copy the packages directory.

Launching test_app

./bin/load_app.sh dartium app/test_app

Will launch test_app in the dartium web browser. Note this only works on Mac at the moment. If you dig into the script it should be easy to adjust for Linux or Windows. If you launch in dartium then the setup_app.dart script does not to be launched when new unit test code is added. If launched in canary or chrome then you will need to execute setup_app.dart to call dart2js for you.

test_app launched

Launching test_ext

The test_ext will be loaded as a chrome extenion and should be present on the right hand side of the omnibox.

test_ext button

test_ext launched

Testing API Generator Tool

Running the unit tests for the tool is dart test/all.dart

Helping out

This project needs a lot of unit tests. At times the js interop story can be tricky and break. Including lots of tests will help this project out, please consider sending pull requests.