Skip to content
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

Test doesn't wait when async step finishes #303

Closed
1 task done
alekskulakov opened this issue Nov 24, 2022 · 5 comments
Closed
1 task done

Test doesn't wait when async step finishes #303

alekskulakov opened this issue Nov 24, 2022 · 5 comments
Assignees

Comments

@alekskulakov
Copy link
Contributor

alekskulakov commented Nov 24, 2022

I'm submitting a ...

  • bug report

The following test fails because it doesn't wait when the step finishes.

[AllureNUnit]
[TestFixture]
public class AllureAsyncStepTest
{
	private bool _isStep1Finished;

	[AllureStep("Step1")]
	public async Task Step1()
	{
		_isStep1Finished = false;
        
		await Task.Delay(500);

		_isStep1Finished = true;
	}

	[Test]
	public async Task SimpleStepTest1()
	{
		await Step1();
        
		Assert.That(_isStep1Finished, Is.True);
	}
}

I expect that the async step should finish before assertion because I use await.

If I comment the attribute [AllureStep("Step1")] then the test works as expected. Like this:

[AllureNUnit]
[TestFixture]
public class AllureAsyncStepTest
{
	private bool _isStep1Finished;

	// [AllureStep("Step1")]
	public async Task Step1()
	{
		_isStep1Finished = false;
        
		await Task.Delay(500);

		_isStep1Finished = true;
	}

	[Test]
	public async Task SimpleStepTest1()
	{
		await Step1();
        
		Assert.That(_isStep1Finished, Is.True);
	}
}
  • Test framework: NUnit@3.13.3
  • Allure adaptor: Allure.NUnit@2.9.2-preview.1
@undron
Copy link
Contributor

undron commented Nov 24, 2022

It's seems that you are using tis lib https://github.com/unickq/allure-nunit
And here is the issue unickq/allure-nunit#28

@alekskulakov
Copy link
Contributor Author

I've checked twice
image

@undron
Copy link
Contributor

undron commented Nov 24, 2022

Yes, I have just notices, that those lib was integrated in this project.
So, anyway, this issue is opened #106

@neparij neparij self-assigned this Dec 22, 2022
@neparij
Copy link
Contributor

neparij commented Dec 22, 2022

Acknowledged. Working on a fix.

@neparij
Copy link
Contributor

neparij commented Dec 23, 2022

Hello everyone!
You can try it out in 2.9.3-preview.1 release

overlord added a commit to overlord/allure-csharp that referenced this issue Dec 29, 2022
overlord added a commit to overlord/allure-csharp that referenced this issue Dec 29, 2022
neparij pushed a commit that referenced this issue Dec 30, 2022
* Add support for async NUnit tests #303

fixes #106 
fixes #83
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants