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 0.10.0 expectAsync Failure and other problems #16677
Comments
Set owner to @kevmoo. |
Removed Priority-Unassigned label. |
This comment was originally written by @shamblett OK, the error seems to be in function shouldCallBack, it tests for test complete using if ( TestCase.isComplete) In 0.9.3 this returns false, in 10.10.0 it returns true meaning the callback is never called as it thinks the test is complete. Looking at the getter for isComplete it uses a combination of 'enabled' and 'result', in 0.9.3 the value for result is 'null' in 0.10.0 it is 'fail' hence in 0.10.0 we think the test is complete and don't call the callback. I've attached two screenshots, one for 9 and one for 10 showing this. If you need any more please nudge me. |
It's possible that the new behavior is catching an exception that you were not aware of and failing the test before expectAsync would have been called. Are you doing async (Stream, Future, etc) operations as part of the test outside of your call to expectAsync? Added NeedsInfo label. |
This comment was originally written by @shamblett Yep, I think this is the case im generating |
Let me see if I can capture this:
Correct? |
Removed Area-UnitTest label. |
This comment was originally written by @shamblett Yes, the expectAsync is not called as explained above(result is fail at this point). What happens is this :- My call that starts all this is : sporran.put(docIdPutOnline, which generates a conflict in CouchDb, it duly replies, this is printed in the console :- Failed to load resource: the server responded with a status of 409 (Conflict) In fact, there's nothing wrong with this, its expected, everything has worked. If I run this test as standalone, it does in fact complete, the output in Dartium is : 2 ERROR Expectation: 2. Document Put/Get/Delete Tests - Put Document Online Conflict. Caught Instance of '_XMLHttpRequestProgressEvent' This is the exception/throw I can't stop or catch. My callback isn't called. So, if I can't stop it I'll handle it I thought, so I changed my call to this :- expect(sporran.put(docIdPutOnline,onlineDoc), throws); The output to the console remains the same, Dartium now outputs :- 2 FAIL Expectation: 2. Document Put/Get/Delete Tests - Put Document Online Conflict. Expected: throws Actual: <null> Which: is not a Function or Future and again my callback is not called. In 0.9.3, none of this mattered(although I think Dart is wrong here, a correctly received 4xx response should not cause anything like the above to happen but that's not for this bug). My callback was always called, it does this BTW :- var wrapper = expectAsync(() { As you can see I just want to check for a 409, if I get one I've passed the test, not failed it. I'm not sure that marking a test as passed or failed means the same as completed which 0.10.0 seems to assume, in 0.9.3 this pass/fail criteria wasn't applied until the test has actually completed I assume, hence It worked OK. Bit stuck now, I can't stop the throwing, neither can I catch it or apparently 'expect' it. The hanging seems to have stopped now, not really sure what caused that but I've cleaned down since yesterday(got a bit hacky!), so the only problem is my callback is not being invoked by 0.10.0 whereas it was in 0.9.3, so I can't check my valid responses. |
This comment was originally written by @shamblett Full output in the console for the conflict response is :- Failed to load resource: the server responded with a status of 409 (Conflict) missed the last two lines in the comment above, note that this does seem to intone that 'XMLHttpRequestProgressEvent' is an exception, so should expect(....throws) not catch it? |
Does sporran.put return anything? A future? |
This comment was originally written by @shamblett No, its void it returns nothing. |
1 similar comment
This comment was originally written by @shamblett No, its void it returns nothing. |
Downgrading criticality. Removed Priority-Critical label. |
This comment was originally written by marrygo...@gmail.com Buy real and fake Passport ,Visa,Driving License,ID CARDS,marriage UNIVERSAL PAPERS UNIVERSAL PAPERS General Support:--------marrygomez11@gmail.com | Attachment: |
This comment was originally written by marrygo...@gmail.com Buy real and fake Passport ,Visa,Driving License,ID CARDS,marriage UNIVERSAL PAPERS UNIVERSAL PAPERS General Support:--------marrygomez11@gmail.com | |
This issue has been moved to dart-lang/test#241. |
This issue was originally filed by @shamblett
I'm testing a browser library package with unit test, I have code like this in my tests :-
var wrapper = expectAsync0(() { ................
This is called as expected and works as expected with unittest 0.9.3
Changing to unittest 0.10.0 and doing this :-
var wrapper = expectAsync(() { ................
breaks, my wrapper callback is never called.
Note, no other code on my side has change here, only in the harness.
Briefly stepping through the code the unit test lib seems to think my callback shouldn't be called in 0.10.0 whereas in 0.9.3 it does think it should be called and calls it.
Also,
The last test that uses expectAsync is called repeatedly in 0.10.0, if you set any test that uses expectAsync to solo_test it just keeps being called, as though it doesn't know its complete, maybe tied to the problem above.
The text was updated successfully, but these errors were encountered: