Matt
Matt

Reputation: 1033

Can't get a Allure report to be generated in c# specflow .net Core. Value cannot be null. (Parameter 'key') Value cannot be null. OnScenarioStart();

I have written a C# test automation Framework on .netcore 3.1 that is using Specflow and Specrun.

I can run the tests with Specrun and get a report, however I would like to get an Allure report.

So I have installed Specflow.Allure. I have an allureConfig.json.

I was hoping that I could now just run the tests and get an Allure report.

However it seems it is not that simple.

When I try to run the tests if fails with the message shown below.

Anyone know what I am doing wrong? Do I need to add more code in order to get the Allure report?

Message: Value cannot be null. (Parameter 'key') Stack Trace: System.ArgumentNullException: Value cannot be null. (Parameter 'key') ConcurrentDictionary2.ThrowKeyNullException() ConcurrentDictionary2.TryGetValue(TKey key, TValue& value) ConcurrentDictionary2.get_Item(TKey key) AllureStorage.Get[T](String uuid) AllureLifecycle.UpdateFixture(String uuid, Action1 update) AllureLifecycle.UpdateFixture(Action1 update) AllureLifecycle.StopFixture(Action1 beforeStop) AllureBindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration) TestExecutionEngine.InvokeHook(IBindingInvoker invoker, IHookBinding hookBinding, HookType hookType) line 352 RunnerTestExecutionEngine.InvokeHook(IBindingInvoker invoker, IHookBinding hookBinding, HookType hookType) TestExecutionEngine.FireEvents(HookType hookType) line 338 TestExecutionEngine.FireScenarioEvents(HookType bindingEvent) line 322 RunnerTestExecutionEngine.FireScenarioEvents(HookType bindingEvent) TestExecutionEngine.OnScenarioStart() line 199 RunnerTestExecutionEngine.OnScenarioStart() TestRunner.OnScenarioStart() line 55 LM01InitialCaseFeature.ScenarioStart() LM01InitialCaseFeature.LM01_01DefaultLM01InitialCase() line 4 StaticOrInstanceMethodExecutor.ExecuteInternal(ITestThreadExecutionContext testThreadExecutionContext) StaticOrInstanceMethodExecutor.Execute(ITestThreadExecutionContext testThreadExecutionContext) TestNodeTask.Execute()

Upvotes: 0

Views: 1487

Answers (1)

Matt
Matt

Reputation: 1033

The solution to this was to add specflow.json file and set to 'copy if newer' so it copies to the debug folder.

The content of specflow.json was:

{
  "stepAssemblies": [
    {
      "assembly": "Allure.SpecFlowPlugin"
    }
  ]
}

After making this change the tests ran correctly and an Allure report was generated.

Upvotes: 2

Related Questions