allure-csharp icon indicating copy to clipboard operation
allure-csharp copied to clipboard

xUnit.net: Using xRetry to retry tests throws InvalidOperationException

Open tkeerthivel opened this issue 6 months ago • 2 comments

I'm submitting a ...

  • [x] bug report
  • [ ] feature request
  • [ ] support request => Please do not submit support request here, see note at the top of this template.

What is the current behavior?

After adding xRetry or Xunit.DependencyInjection.xRetry to a project having Allure.Xunit package, System.InvalidOperationException is thrown when running any test.

System.InvalidOperationException : No fixture context is active.

If the current behavior is a bug, please provide the steps to reproduce and, if possible, a minimal demo of the problem

  1. To a project having Allure.Xunit package and tests, add xRetry or Xunit.DependencyInjection.xRetry package.
  2. Annotate the constructor with [AllureBefore].
  3. Run any test.
  4. The test won't start and throws the above error.

What is the expected behavior?

The test should run without any errors

What is the motivation / use case for changing the behavior?

To retry failed tests

Please tell us about your environment:

  • OS: Windows
  • .NET framework: .NET 8
  • Allure version: 2.12.1
  • Test framework: xUnit

Other information

Message:  System.InvalidOperationException : No fixture context is active.

Stack Trace: 

AllureLifecycle.UpdateFixture(Action`1 update) line 322
AllureLifecycle.StopFixture(Action`1 beforeStop) line 345
ExtendedApi.ResolveItem(Func`2 stop, Exception error) line 625
ExtendedApi.ResolveFixture(Exception error) line 258
AllureAbstractStepAspect.ThrowFixture(MethodBase metadata, Exception e) line 79
AllureAbstractStepAspect.OnTargetInvokeException(MethodBase metadata, Exception e) line 100
AllureAbstractStepAspect.WrapSyncVoid(Func`2 target, Object[] args, MethodBase metadata, String stepName, List`1 stepParameters) line 144```

tkeerthivel avatar Aug 28 '24 12:08 tkeerthivel