quartznet icon indicating copy to clipboard operation
quartznet copied to clipboard

Testing quartz scheduler in xUnit

Open khanhna opened this issue 4 years ago • 1 comments

Describe the bug

The Scheduler not running as expected when testing with xUnit

Version used

v3.2.3, on .Net Core 3.1

To Reproduce

xUnit test repo

  1. Run all the test.
  2. Remove the Skip parameter on Should_Mark_Book_As_Available test.
  3. Run Should_Mark_Book_As_Available test separately.
  4. Run all the test again.

Expected behavior

Every tests should all be pass.

Additional context

  • This test demo using quartz scheduler integrated in Masstransit.
  • The test Should_Mark_Book_As_Available often failed.(not always fail, just most of the times, and always passed if running separately).

khanhna avatar Dec 31 '20 14:12 khanhna

A temporary workaround

Put the [assembly: CollectionBehavior(DisableTestParallelization = true)] for all the test to run sequentially.

khanhna avatar Jan 06 '21 02:01 khanhna