SpecResults
SpecResults copied to clipboard
SpecResults report with Parallel Tests
Hello, I'm using the SpecResults to generate a report for my tests and, as the documentation explains, I added the creation of the report in the BeforeTestRun. The thing is, when I added the "[assembly: Parallelizable(ParallelScope.Fixtures)]" to my AssemblyInfo.cs, the test stopped work, with the following error:
------ Run test started ------ NUnit Adapter 3.7.0.0: Test execution started Running selected tests in D:\Documents\Git\TestAutomationFramework\Fourth.Automation.Framework.Functional\bin\Chrome\Fourth.Automation.Framework.Functional.dll NUnit3TestExecutor converted 2 of 2 NUnit test cases TearDown failed for test fixture Fourth.Automation.Framework.Functional.Features.SupportFeature TechTalk.SpecFlow.SpecFlowException : The FeatureContext.Current static accessor cannot be used in multi-threaded execution. Try injecting the feature context to the binding class. See http://go.specflow.org/doc-multithreaded for details. TearDown : System.NullReferenceException : Object reference not set to an instance of an object. at TechTalk.SpecFlow.FeatureContext.get_Current() at SpecResults.Reporters.BeforeFeature() at lambda_method(Closure , IContextManager ) at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType bindingEvent) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnFeatureStart(FeatureInfo featureInfo) at TechTalk.SpecFlow.TestRunner.OnFeatureStart(FeatureInfo featureInfo) at Fourth.Automation.Framework.Functional.Features.SupportFeature.FeatureSetup() --TearDown at SpecResults.Reporters.AfterFeature() at lambda_method(Closure , IContextManager ) at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType bindingEvent) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnFeatureEnd() at TechTalk.SpecFlow.TestRunner.OnFeatureEnd() at Fourth.Automation.Framework.Functional.Features.SupportFeature.FeatureTearDown() TearDown failed for test fixture Fourth.Automation.Framework.Functional.Features.LoginFeature TechTalk.SpecFlow.SpecFlowException : The FeatureContext.Current static accessor cannot be used in multi-threaded execution. Try injecting the feature context to the binding class. See http://go.specflow.org/doc-multithreaded for details. TearDown : System.NullReferenceException : Object reference not set to an instance of an object. at TechTalk.SpecFlow.FeatureContext.get_Current() at SpecResults.Reporters.BeforeFeature() at lambda_method(Closure , IContextManager ) at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType bindingEvent) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnFeatureStart(FeatureInfo featureInfo) at TechTalk.SpecFlow.TestRunner.OnFeatureStart(FeatureInfo featureInfo) at Fourth.Automation.Framework.Functional.Features.LoginFeature.FeatureSetup() --TearDown at SpecResults.Reporters.AfterFeature() at lambda_method(Closure , IContextManager ) at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.FireEvents(HookType bindingEvent) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnFeatureEnd() at TechTalk.SpecFlow.TestRunner.OnFeatureEnd() at Fourth.Automation.Framework.Functional.Features.LoginFeature.FeatureTearDown() NUnit Adapter 3.7.0.0: Test execution complete ========== Run test finished: 2 run (0:00:01.3014074) ==========
I know static methods shouldn't be use in parallel tests, but then how should the report be implemented since the BeforeTestRun has to be static?
(Sorry if here's not the place for questions)
Thanks in advance
any update on this?