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
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
TestErrorthrows error when Step is trying to find it's parent inAllureStorage.cs line58Below are code examples you can reproduce it.
Allure.Commons 3.0.0.10