-
Notifications
You must be signed in to change notification settings - Fork 65
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
Error when using Allure with async/await #83
Comments
Hi @VictorYakushenko, |
Details in #106 |
I've seen this issue heaps with Async and TestCaseSource. When I run into it again I will put something together. I'm glad someone has an idea about what might be going wrong. I was stumped myself. |
I've tested this patch and it appears to work well in my corporate environment. I've also included a sample test that puts it through it paces below. Is there anything stopping this from going through? using System; namespace DeliveryAssured.NUnitSamples.AllureIssues
} |
Had same problem, AllureLifecycle.Instance.AddAttachment worked until an await statement was used in the nunit test (async nunit test). As suggested above, replacing ThreadLocal by AsyncLocal solved the problem. (in the allure.common library) The class AsyncLocal is only supported from .net framework 4.6 and above. Didn't do any extensive testing |
I've also hit this same issue. |
any updates here? |
Do you have any updates here? Who can resolve this issue? |
Having issues with this as well. Breaks with playwright completely. Edit: I found a workaround for our framework. [TearDown] is the place where we place the attachments to Allure. public async Task QED()
{
screenshot = AppDomain.CurrentDomain.BaseDirectory + "screenshots/screenshot.png"
await page.ScreenshotAsync(new PageScreenshotOptions { Path = screenshot });
}
[TearDown]
public void TearDown()
{
AllureLifecycle.Instance.AddAttachment("image", "image/png", screenshot );
} The downside is that I have to call QED() in every test instead of letting TearDown handle it. But otherwise is works. |
I've just started hitting this issue too - is anyone able to fix it soon? |
Because of this error using Allure in any Playwright test suite is impossible, all playwright methods are async so you have to call all your test methods using await which causes this error. |
Hello everyone! |
2.9.4-preview.1 package |
Hello, here is another unstable behavior using 2.9.4-preview.1 Try this code:
I understand that this is bad practice, but... |
@undron, try |
@overlord All seems good now |
Same issue exists in Xunit, any plan or simple way to fix it? |
Hi, @sphinxy and everyone! If the issue still exists, please, let me know here. |
I'm submitting a ...
What is the current behavior?
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
I get an error when using Allure with async/await
What is the expected behavior?
Allure should works as without async/await
What is the motivation / use case for changing the behavior?
I think using AsyncLocal instead ThreadLocal in stepContext will fix it like in NUnit framework
https://github.com/nunit/nunit/blob/master/src/NUnitFramework/framework/Internal/TestExecutionContext.cs
Please tell us about your environment:
Other information
The text was updated successfully, but these errors were encountered: