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

Await issue #106

Closed
unickq opened this issue May 8, 2020 · 8 comments · Fixed by #371
Closed

Await issue #106

unickq opened this issue May 8, 2020 · 8 comments · Fixed by #371
Assignees
Labels

Comments

@unickq
Copy link
Contributor

unickq commented May 8, 2020

Hey there.

This is possible duplicate of #83. But I don't see example code there, so not sure.

The issue here - test with await TestError throws error when Step is trying to find it's parent in AllureStorage.cs line58

System.ArgumentNullException : Value cannot be null.
Parameter name: key
   at System.Collections.Concurrent.ConcurrentDictionary`2.TryGetValue(TKey key, TValue& value)
   at System.Collections.Concurrent.ConcurrentDictionary`2.get_Item(TKey key)
   at Allure.Commons.Storage.AllureStorage.Get[T](String uuid)
   at Allure.Commons.Storage.AllureStorage.AddStep(String parentUuid, String uuid, StepResult stepResult)
   at Allure.Commons.AllureLifecycle.StartStep(String parentUuid, String uuid, StepResult stepResult)
   at Allure.Commons.AllureLifecycle.StartStep(String uuid, StepResult result)

Below are code examples you can reproduce it.

public class Tests {
 private AllureWrapper allure = new AllureWrapper();

 [SetUp]
 public void SetUp() {
  AllureLifecycle.Instance.CleanupResultDirectory();
  allure.SetUp();
 }

 [TearDown]
 public void TearDown() {
  allure.TearDown();
 }

 // The test which is failing
 [Test]
 public async Task TestError() {
  await Task.Delay(1000);
  allure.Step();
 }

 // Same test without error
 [Test]
 public async Task TestNoError() {
  Task.Delay(1000).GetAwaiter().GetResult();
  allure.Step();
 }
}
public class AllureWrapper {
 private TestResultContainer testResultContainer = new TestResultContainer {
  uuid = "cont"
 };
 private TestResult testResult = new TestResult {
  uuid = "test"
 };


 public void SetUp() {
  AllureLifecycle.Instance.StartTestContainer(testResultContainer);
  AllureLifecycle.Instance.StartTestCase(testResultContainer.uuid, testResult);
 }


 public void TearDown() {
  AllureLifecycle.Instance.StartTestCase(testResult);
  AllureLifecycle.Instance.StopTestContainer(testResultContainer.uuid);

  AllureLifecycle.Instance.WriteTestContainer(testResultContainer.uuid);
  AllureLifecycle.Instance.WriteTestCase(testResult.uuid);
 }

 public void Step(string name = "Step") {
  var step = new StepResult() {
   name = name
  };
  AllureLifecycle.Instance.StartStep(Guid.NewGuid().ToString(), step);
  AllureLifecycle.Instance.StopStep();
 }
}

Allure.Commons 3.0.0.10

@VictorYakushenko
Copy link

"#83" - yes it is the same issue. Thank you for clear description and steps to repro

@EvgenyMarchuk
Copy link

Hello! When are you going to solve this problem? I am really looking forward to it :). Thank!
Respectfully!

@NaZaRKIN123
Copy link

any updates here?

@VolodymyrDmytriukhinDevPro

any updates till now?

@neparij
Copy link
Contributor

neparij commented Dec 30, 2022

Hello everyone!
Should be fixed in upcoming preview release with changes authored by @overlord
I'll write as soon as I upload it.

@neparij
Copy link
Contributor

neparij commented Dec 30, 2022

2.9.4-preview.1 package

@neparij
Copy link
Contributor

neparij commented Jan 9, 2023

Some additional fixes comes in 2.9.4-preview.2 package

@delatrie delatrie self-assigned this Sep 7, 2023
@delatrie delatrie added the bug label Sep 7, 2023
@delatrie delatrie linked a pull request Sep 7, 2023 that will close this issue
2 tasks
@delatrie
Copy link
Contributor

Should be fixed in 2.10.0. Please, leave me a comment here in case it's not.

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

Successfully merging a pull request may close this issue.

7 participants