-
Notifications
You must be signed in to change notification settings - Fork 106
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
NUnit adapter fires asynchronous events to InProcDataCollector #560
Comments
I have tested with older nunit versions. It looks like the change happened in 3.11.0:
|
I noticed #510 which says:
It looks related. If I'm reading it correctly, with this setting the InProcDataCollector should get events synchronously. And indeed, when I used it in the repro, the events were fired correctly. If that's the case, I wonder, maybe it should be the default? I mean, without it, the data collector is partially unusable. I think it is also expected that by default the events are synchronized with tests, also looking at the InProcDataCollection docs in https://github.com/Microsoft/vstest/blob/master/src/Microsoft.TestPlatform.ObjectModel/DataCollector/InProcDataCollector/InProcDataCollector.cs that's the impression (although it's not 100% as it says e.g. "Called when test case starts" for TestCaseStart) |
@pkruk2 Thanks for the issue and the very well prepared repro! We'll have a look, and find a fix. |
@pkruk2 can you clarify, when you say that the issue happened in NUnit 3.11, do you mean that it happened when you changed the NUnit Adapter or NUnit Framework to 3.11? I think that you mean the adapter project, but I want to confirm because there are also changes in the framework that might have caused this. |
@rprouse Seems he have been switching both at the same time, but the adapter doesn't "fire any events", but just responds to events from the engine, so the root cause "should" be in the engine or framework. |
@rprouse it's as @OsirisTerje said, I was switching both - i.e. I had framework 3.10.1 and adapter 3.10.0 (latest 3.10.x) and then switched both to 3.11.0 (latest 3.11.x) |
I've looked through the NUnit Framework changes between 3.10.1 and 3.11 and don't see anything obvious. #510 does look very suspicious. @pkruk2 have you tried adding the following to your runsettings? I'm not certain you should need to, but I'd like to see if it fixes the issue. <RunConfiguration>
<CollectDataForEachTestSeparately>true</CollectDataForEachTestSeparately>
</RunConfiguration> |
@rprouse yes, I wrote about it 5 days ago ;) |
Summary
This is a followup from microsoft/vstest#1833
The issue: In-Proc Data Collector events are not (fully?) synchronized with executed tests. For example the sequence of events currently could look like this:
while it should look like this:
This is a problem for example when you want to collect coverage and connect it with executed test.
In my tests the problem appears in nunit 3.11.0. Older version nunit 3.9.0 seems to be OK, so maybe this is a regression? I have not tested all versions of nunit between 3.9.0 and 3.11.0 so I don't know when the change happened.
Repro
Attaching solution: VstestEvents.zip
It contains 3 test project (for nunit, xunit and mstest), "VstestRunner" project which runs UT and the "VstestRunner.InProcDataCollector" project. It also contains runTest.bat which may need to be updated.
As a result, it produces two .txt files which contain logs from UT and from data collector. The location of the files differs between UT frameworks.
How to use Repro
In result, there should be 2 new files created next to runTest.bat file:
You can also edit runTest.bat to uncomment lines which execute tests for xunit and mstest. In that case, the from_*.txt files will be created next to analyzed assembly (in bin/debug)
My results from the running tests
nunit 3.11.0:
nunit 3.9.0:
The text was updated successfully, but these errors were encountered: