Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unittest_vm breaks on failed asyncTests #2195

Closed
DartBot opened this issue Mar 16, 2012 · 3 comments
Closed

Unittest_vm breaks on failed asyncTests #2195

DartBot opened this issue Mar 16, 2012 · 3 comments
Labels
area-test Cross-cutting test issues (use area- labels for specific failures; not used for package:test). closed-obsolete Closed as the reported issue is no longer relevant

Comments

@DartBot
Copy link

DartBot commented Mar 16, 2012

This issue was originally filed by VadimTsu...@gmail.com


What steps will reproduce the problem?

  1. Create and run dart script with async test:

import("dart:io");

import('../third_party/testing/unittest/unittest_vm.dart');

main(){
  asyncTest("Failed async test",1,(){
    Completer completer = new Completer();
    new Timer(10,(timer)=>completer.complete(1));
    completer.future.then((v){
      Expect.equals(2, v);
      callbackDone();
   });
 });
}

What is the expected output?
FAIL: Failed async test
  Expect.equals(expected: <2>, actual: <1>) fails.

0 PASSED, 1 FAILED, 0 ERRORS

What do you see instead?
Stack trace -
Unhandled exception:
Expect.equals(expected: <2>, actual: <1>) fails.
 0. Function: 'Expect._fail@127eafe4' url: 'bootstrap' line:1460 col:5
 1. Function: 'Expect.equals' url: 'bootstrap' line:1195 col:10
 2. Function: '::function' url: 'file:///C:/Dropbox/dart/Projects/mongo-dart/tests/testUnitTest.dart' line:8 col:20
 3. Function: 'FutureImpl._complete@924b4b8' url: 'bootstrap_impl' line:3126 col:17
 4. Function: 'FutureImpl._setValue@924b4b8' url: 'bootstrap_impl' line:3140 col:14
 5. Function: 'CompleterImpl.complete' url: 'bootstrap_impl' line:3209 col:26
 6. Function: '::function' url: 'file:///C:/Dropbox/dart/Projects/mongo-dart/tests/testUnitTest.dart' line:6 col:45
 7. Function: '_Timer@14117cc4._handleTimeout@14117cc4' url: 'dart:io' line:6979 col:28
 8. Function: '_Timer@14117cc4._handleTimeout@14117cc4' url: 'dart:io' line:6986 col:9
 9. Function: '_Timer@14117cc4.function' url: 'dart:io' line:6995 col:23
 10. Function: '_ReceivePortImpl@6be832b._handleMessage@6be832b' url: 'dart:isolate' line:281 col:22

What version of the product are you using? On what operating system?
Dart-sdk revision 5294
Unittest from bleeding_edge repo revision 5535
OS: Windows7, 32bit
Please provide any additional information below.

@iposva-google
Copy link
Contributor

The Expect class does throw exceptions if an expectation fails. I am not entirely clear whether the unittest library should be expected to be intercepting these exceptions or not.


cc @munificent.
cc @jmesserly.
Added Area-Test, Triaged labels.

@DartBot
Copy link
Author

DartBot commented Mar 16, 2012

This comment was originally written by carsten....@gmail.com


whether the unittest library should be expected to be intercepting these exceptions or not.

It seems so, because in sync tests, Expect calls(as well as the except(foo).equals(bar) shortcuts) do work as expected and without breaking the current testsuite.

As expected - not stopping the suite from running, but reporting a failed test:
test("testFoo", () => expect(2).equals(3));

Similar test - using asyncTest - is throwing instead reporting:
asyncTest("testFoo", 200, () =>
  new Timer(150, (t) { expect(2).equals(3); callbackDone(); })
);

@gramster
Copy link

Added AssumedStale label.

@DartBot DartBot added Type-Defect area-test Cross-cutting test issues (use area- labels for specific failures; not used for package:test). closed-obsolete Closed as the reported issue is no longer relevant labels Sep 17, 2012
copybara-service bot pushed a commit that referenced this issue Sep 8, 2023
Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (https://github.com/dart-lang/dartdoc/compare/a32ba3a..adc76e6):
  adc76e6d  2023-09-06  Parker Lougheed  Take advantage of a few Dart 3 features (#3491)

leak_tracker (https://github.com/dart-lang/leak_tracker/compare/098bafc..4616c8b):
  4616c8b  2023-09-05  Polina Cherkasova  Note about OverlayEntry. (#142)
  fd7d70f  2023-09-01  dependabot[bot]  Bump actions/checkout from 3.5.3 to 3.6.0 (#141)
  c6c1004  2023-09-01  Polina Cherkasova  - (#139)
  0298e20  2023-08-31  Polina Cherkasova  Add a test specific rule. (#138)
  ea17fa4  2023-08-29  Polina Cherkasova  Increase version of leak_tracker_flutter_testing (#136)
  8f830d6  2023-08-29  Polina Cherkasova  Update pubspec.yaml (#135)
  8a54575  2023-08-29  Polina Cherkasova  Enable connection to vm service for flutter testing and define matcher for reporting for memory
allocations. (#128)
  88a19a7  2023-08-28  Polina Cherkasova  - (#133)
  2070856  2023-08-24  Polina Cherkasova  Add instruction to start tracking instances of ChangeNotifier earlier. (#130)
  eb6113a  2023-08-23  Polina Cherkasova  Measure how memory is consumed by a test. (#114)
  72264f7  2023-08-22  Polina Cherkasova  Fix misspelling. (#131)
  87c9e9e  2023-08-16  Polina Cherkasova  Add debugging construcstors to LeakTrackingTestConfig, per leak type. (#129)
  b29547a  2023-08-15  Polina Cherkasova  Create visibility for roadmap for leak_tracker. (#124)
  23b15b6  2023-08-15  Polina Cherkasova  Fix issue of using wrong settings for a phase. (#122)
  713f646  2023-08-11  Polina Cherkasova  Enable global configuration for leak tracking. (#121)
  19b01cf  2023-08-10  Polina Cherkasova  Create package leak_tracker_flutter_testing. (#119)
  02d0b2f  2023-08-07  Polina Cherkasova  Stop failing if object is disposed twice. (#117)
  2026379  2023-08-04  Polina Cherkasova  Remove not-published versions and increase leak_tracker version. (#116)
  9bb71c6  2023-08-04  Polina Cherkasova  Stop requiring registration of disposed objects. (#113)
  8939456  2023-08-04  Polina Cherkasova  Refactor dispatcher. (#115)
  6f54f5a  2023-08-01  Polina Cherkasova  Start vm service when needed. (#112)
  b045c5e  2023-08-01  Polina Cherkasova  Reorganize leak tracker for better performance. (#106)
  127b83c  2023-07-31  Polina Cherkasova  Update TROUBLESHOOT.md (#108)
  6dabd33  2023-07-31  Polina Cherkasova  Simplify and clarify instructions to fix leaks. (#107)
  c53db68  2023-07-25  Polina Cherkasova  Improve code structure. (#103)
  10cce1a  2023-07-24  Polina Cherkasova  Rename `gcCountBuffer` to `numberOfGcCycles`. (#101)
  3a061a4  2023-07-21  Polina Cherkasova  Improve doc comments. (#100)
  6e3f57c  2023-07-21  Polina Cherkasova  Fix and test cover case of customized `gcCountBuffer` (#99)
  2152aab  2023-07-21  Polina Cherkasova  Add details about hidden leaks. (#97)

lints (https://github.com/dart-lang/lints/compare/da44af3..8d5f750):
  8d5f750  2023-09-06  Devon Carew  move the list of lint rules from the readme to a separate rules.md file (#145)

native (https://github.com/dart-lang/native/compare/a2dfedc..387f894):
  387f894  2023-09-06  Gabriel Terwesten  [native_toolchain_c] Default handling for PIC/PIE compiler flags (#121)
  0a4e5f8  2023-09-06  Gabriel Terwesten  Add support for defines to `CBuilder` (#120)

webdev (https://github.com/dart-lang/webdev/compare/fc876cb..9487a45):
  9487a459  2023-09-05  Jacob Bang  Update README.md to use `dart pub` instead of `pub` (#2195)
  07367779  2023-08-31  Elliott Brooks  Pass the package config directly to the load strategy instead of depending on an app entrypoint
(#2203)
  0044d753  2023-08-24  Jonas Termansen  Fix conflicting webdev smoke package names. (#2202)
  6183f270  2023-08-23  Elliott Brooks  Allow client to specify a way to convert an absolute path into a g3-relative path (#2200)
  b244b899  2023-08-22  Elliott Brooks  Allow client to specify how to find the package config  (#2199)

Change-Id: Ic00adc68ec01cd0cc6e27be665436de5095d8d07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324801
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-test Cross-cutting test issues (use area- labels for specific failures; not used for package:test). closed-obsolete Closed as the reported issue is no longer relevant
Projects
None yet
Development

No branches or pull requests

3 participants