question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Final Non-Parallelizable Test appears to record incorrect duration when TimeoutAttribute used

See original GitHub issue

My test assembly runs with mainly parallel fixtures, via [assembly: Parallelizable(ParallelScope.Fixtures)]. There are approx 10,000 tests - within this, I have a couple of tests using TimeOutAttribute I’ve specifically marked the fixtures ParallelScope.None. The below is a minimum example of such a fixture.

[TestFixture, Parallelizable(ParallelScope.None)]
public class TestFixture
{
    [Test, Timeout(100)]
    public void ATest()
    {
    }
}

When running under NUnit Console, the final Non-Parallelizable Test appears to record an additional ~30 seconds in duration. (Even in the above situation, where the test is empty.) Hence the Timeout fails.

The extra time added to this test, appears to be within the console runner activity. I’m running a single assembly. When I remove the troublesome test, I see that the test-run recorded end-time is 30 seconds later than the end-time of the single test suite. With the bad test - the bad-test-end-time roughly matches test-run-end-time - but test-suite-end-time remains the same. Meaning the end time of the bad test is AFTER the end time of the assembly test-suite that contains it.

This bug DOESN’T appear with NUnitLite - where I’ve previously run these tests.

Some further specifics.

  1. This only occurs when I have a mix of ParallelScope.Fixtures and ParallelScope.None. If I have all tests in parallel, or none in parallel, the per-test duration looks to be sensible.
  2. The TimeoutAttribute appears key, without this, the test has a normal duration.
  3. The overall (reported) test run duration remains constant, whether I use Timeout on the non-parallelizable test, and the test reports taking 30 seconds longer, or not. This makes me suspect a reporting issue, rather than a test-running issue.
  4. In terms of the timeline, it appears that the ParallelScope.Fixtures tests are all running first, then the ‘none’ fixture is ran once those have completed. I’m unsure as to where the additional 30 seconds comes from.

Additionally, for some reason, the failed test isn’t reported in the console. This is the output I see - there’s no log of failed tests.

image

I’m suspicious there are two bugs here:

  1. What is the console doing for an extra 30 seconds, after the completion of the test-suite run. (The console run also takes ~30 seconds longer than the NUnitLite run.)
  2. Why is the ‘bad-test’ duration incorrect, and outside of the overall test suite run.

There’s probably more digging to do here, but only so much I can do at the moment. Appreciate any early thoughts as to what’s going on.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
CharliePoolecommented, Jul 21, 2017

In fact, it’s a worker event being handled by the dispatcher. As each worker finishes a task, the Idle event fires and the dispatcher checks to see if there is no more work in the shift. If not, it terminates the shift and either starts a new one or ends the run completely.

Basically, there are no special threads for either the dispatcher or the three different shifts. Everything happens on worker threads.

0reactions
ChrisMaddockcommented, Jul 21, 2017

Thanks Charlie - and thanks for the pre-emptive fix! 😄

I think I made some assumptions by the “Parallel shift ending” log message being posted from one specific worker thread. I assume in this case, that thread 16 was the ‘master worker’ or so, which decided when all the work was complete?

Read more comments on GitHub >

github_iconTop Results From Across the Web

NonParallelizable
NonParallelizable. This attribute is used to indicate that the test on which it appears may not be run in parallel with any other...
Read more >
Framework Release
This release addresses several misses with the new FixtureLifeCycle attribute, switches to using SourceLink and NuGet snupkg packages for debugging into NUnit ...
Read more >
CHANGES - Mind Map
1638 TimeoutAttribute not available when targeting netcoreapp framework ... 3181 Template Based Test Naming - Incorrect truncation for individual arguments.
Read more >
Viewing online file analysis results for 'nunit.framework.dll'
You have given the wrong number of arguments to the method in the TestCaseSourceAttribute, please check the number of parameters passed in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found