dotnet-test-nunit
dotnet-test-nunit copied to clipboard
Duration is for the whole run including discovery
This is different than the behaviour in NUnit console. As reported by @jskeet in nunit/nunit#1371;
One difference I've noticed between this and the console app runner is that the "dotnet test" version seems to include the time spent finding tests in the overall duration, whereas the "dotnet run" command I used to use with NUnitLite didn't. In Noda Time, this means if I run with
--where=cat==Foo
(there are no such tests in that category), "dotnet test" reports a duration of 14s where as "dotnet run" reports a duration of 0.01s - despite them both taking about the same real elapsed time.
Because we don't have the full NUnit engine to run the tests, the code is more simplistic, but I might be able to start the clock on the first test started event rather than wrapping the test run.
I don't know if I should open a new issue for this, but I see a different anomaly with test durations. Test duration seems to be random (or nothing, 1ms for all my tests) in .NET Core tests. To try this out, create a test method like this:
public void Test1()
{
var t = Task.Factory.StartNew(() => Thread.Sleep(1000));
t.Wait();
}
Place this test in a (classic) Class Library project, and the duration will be 1 sec. Place it in a .NET Core Class Library project, and the duration is 1 ms.
Thanks, sounds like a new bug. I will investigate when I look at this issue. I may create a new issue for it then.
@rprouse On my machine, for whatever reason, duration in TestExplorer is reported as "min", whatever that is supposed to mean (it does not appear to be minutes). For @BalassaMarton's 1 second test above I get around "16800 min".
When I run dotnet test the TestResult.xml will report a duration of "1.004473", which seems be pretty close to a second.