allure-csharp
allure-csharp copied to clipboard
Await issue
Hey there.
This is possible duplicate of https://github.com/allure-framework/allure-csharp/issues/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
"#83" - yes it is the same issue. Thank you for clear description and steps to repro
Hello! When are you going to solve this problem? I am really looking forward to it :). Thank! Respectfully!
any updates here?
any updates till now?
Hello everyone! Should be fixed in upcoming preview release with changes authored by @overlord I'll write as soon as I upload it.
2.9.4-preview.1 package
Some additional fixes comes in 2.9.4-preview.2 package
Should be fixed in 2.10.0. Please, leave me a comment here in case it's not.