Questions tagged [dart-unittest]

A library for writing dart unit tests.

Dart includes a unit test library that is easy to use, adaptable, and supports both synchronous and asynchronous tests.

More information:

53 questions
1
vote
1 answer

MockHttpBackend - Unexpected request

I have a test (using jasmine syntax from the AngularDart project) describe("MockHttpBackend", () { beforeEach(() { setUpInjector(); module((Module module) { module ..type(HttpBackend, implementedBy: MockHttpBackend); //…
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
1
vote
1 answer

Why the async test passed, but there are some error messages displayed?

Dart test code: _doSomething2(callback(int x, int y)) { callback(1, 2); } test('async test, check a function with 2 parameters', () { new Timer(new Duration(milliseconds:100), _doSomething2(expectAsync2((x, y) { expect(x,…
Freewind
  • 193,756
  • 157
  • 432
  • 708
1
vote
2 answers

how do I make analysis warnings trigger runtime failure

In the following example, main is allowed to call a sniff function on Dog that I would prefer would somehow break. If I say exactly what a Dog can do, but somehow the client knows more and can get the object to do more with that special knowledge -…
user1338952
  • 3,233
  • 2
  • 27
  • 41
0
votes
1 answer

how do I unit test with multiple expect

The unit test I write below doesn't work when there are 3 expect, how can I rewrite the unit test below: test('400 bad response', () async { when( () => sampleClient.getTransaction( '1'), ).thenThrow(DioError( response:…
Alvin
  • 8,219
  • 25
  • 96
  • 177
0
votes
1 answer

How to write tests using the service scope

My app is accessing object from the service scope (package:gcloud/service_scope.dart), like the storageService and additional services that I put inside the scope with ss.register(). Now I want to unit test a function that accesses this scope, and…
enyo
  • 16,269
  • 9
  • 56
  • 73
0
votes
1 answer

Test is failing even though expectations are met

I have a test that looks like this: test('should throw error if threshold is null', (){ final findEngine = new FindEngine(); expect(findEngine.streamResults('foo', null), throwsA(new …
w.brian
  • 16,296
  • 14
  • 69
  • 118
0
votes
1 answer

Dart unittest produces unhelpful output

I am working through the AngularDart tutorial and trying to write unit tests as I complete the exercises. I have a test that looks like this: test('should convert sugar ingredient to maple syrup', inject((SugarFilter filter) { var r1 = new…
kpg
  • 7,644
  • 6
  • 34
  • 67
0
votes
0 answers

How do I close Dartium after unit test completes

After the unit test completes (success or failure) the Dartium browser remains open. Is there a way to close it from within the test?
Anders
  • 1,337
  • 1
  • 8
  • 17
1 2 3
4