Noksa / Allure.NUnit

C# NUnit Allure with improvements and SpecFlow3 adapter
MIT License
18 stars 6 forks source link

The recording of steps does not work when using multithreading inside current test #9

Closed Noksa closed 6 years ago

Noksa commented 6 years ago

Using multithreading inside test like Task.Run(() => AllureLifecycle.Instance.Verify.Pass("Pass")) throws exceptions

Versions

Noksa commented 6 years ago

Multi-threading inside the test works only in test body, not in [Setup] or [TearDown]. Also it's not working on [OneTimeSetup] and [OneTimeTearDown] at fixture.

If you use multi-threading inside the test, make sure that before leaving test all the threads have done their job of recording the allure steps, otherwise errors may occur. for example:

var task = Task.Run(() =>
            {
                // some code for record allure steps
            });
// some other code

// wait for task before exit test
task.Wait(); // IMPORTANT LINE
Noksa commented 6 years ago

Fixed in 2.6