samedi 31 janvier 2015

how to setup a unittest for a web-project

I have problems to properly configure my first unittest in the DartEditor.


I wrote a web-app with dart that is located in the web-folder. Now i added a test-folder parallel to web with a file called test.dart: library dartingflame_test;



import 'dart:math';
import 'package:unittest/unittest.dart';
import 'package:unittest/html_config.dart';
import 'package:mockito/mockito.dart';
import '../web/dartingflame.dart';

void main() {
useHtmlConfiguration();

test("verify robot's direction after move", verifyRobotDirectionAfterMove);
}

void verifyRobotDirectionAfterMove() {...}


Unfortunatly i now have problems to run this test file.



  • Run with Dartium leads to the message: Unable to locate associated html file

  • Run leads to: Observatory listening on http://127.0.0.1:49919 The built-in library 'dart:html' is not available on the stand-alone VM. 'package:unittest/html_config.dart': error: line 10 pos 1: library handler failed import 'dart:html';


Using useVMConfiguration() instead of useHtmlConfiguration() doesn't help. The test execution still complaints about the import 'dart:html';-line in the library under test.


I couldn't find a solution in the "Unit Testing with Dart"-article.


Aucun commentaire:

Enregistrer un commentaire