Skip to content

Conversation

@SimonCropp
Copy link
Contributor

No description provided.

@baynezy
Copy link
Owner

baynezy commented May 23, 2022

@SimonCropp - thanks for this. I have checked out your branch and when I run dotnet test I get the following output:-

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:02.39]     Concatenate two HTML snippets [FAIL]
  Failed Concatenate two HTML snippets [31 ms]
  Error Message:
   System.Exception : Expected to find a `[UsesVerify]` on test class. File: HtmlGeneratorStepDefinitions.cs.
  Stack Trace:
     at VerifyXunit.Verifier.GetVerifier(VerifySettings settings, String sourceFile) in /_/src/Verify.Xunit/Verifier.cs:line 19
   at VerifyXunit.Verifier.<>c__DisplayClass1_0.<<Verify>b__0>d.MoveNext() in /_/src/Verify.Xunit/Verifier.cs:line 29
--- End of stack trace from previous location ---
   at Example.Spec.Steps.HtmlGeneratorStepDefinitions.ThenTheResultShouldBeACombinationOfTheSnippets() in C:\_temp\SpecFlowIssue\SpecFlowIssue\test\Example.Spec\Steps\HtmlGeneratorStepD
efinitions.cs:line 33
   at TechTalk.SpecFlow.Bindings.SynchronousBindingDelegateInvoker.<>c__DisplayClass2_0.<<InvokeBindingDelegateAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at TechTalk.SpecFlow.Bindings.AsyncHelpers.<>c__DisplayClass1_0`1.<<RunSync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at TechTalk.SpecFlow.Bindings.AsyncHelpers.ExclusiveSynchronizationContext.BeginMessageLoop()
   at TechTalk.SpecFlow.Bindings.AsyncHelpers.RunSync[T](Func`1 task)
   at TechTalk.SpecFlow.Bindings.SynchronousBindingDelegateInvoker.InvokeBindingDelegateAsync(Delegate bindingDelegate, Object[] invokeArgs)
   at TechTalk.SpecFlow.Bindings.SynchronousBindingDelegateInvoker.InvokeDelegateSynchronously(Delegate bindingDelegate, Object[] invokeArgs)
   at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration)
   at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStepMatch(BindingMatch match, Object[] arguments, TimeSpan& duration)
   at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(IContextManager contextManager, StepInstance stepInstance)
   at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep()
   at TechTalk.SpecFlow.TestRunner.CollectScenarioErrors()
   at Example.Spec.Features.HtmlGenerationFeature.ScenarioCleanup()
   at Example.Spec.Features.HtmlGenerationFeature.ConcatenateTwoHTMLSnippets() in C:\_temp\SpecFlowIssue\SpecFlowIssue\test\Example.Spec\Features\HtmlGeneration.feature:line 8
  Standard Output Messages:
 Given the first snippet is a paragraph
 -> done: HtmlGeneratorStepDefinitions.GivenTheFirstSnippetIsAParagraph() (0.0s)
 And the second snippet is an image
 -> done: HtmlGeneratorStepDefinitions.GivenTheSecondSnippetIsAnImage() (0.0s)
 When the two snippets are concatenated
 -> done: HtmlGeneratorStepDefinitions.WhenTheTwoSnippetsAreConcatenated() (0.0s)
 Then the result should be a combination of the snippets
 -> error: Expected to find a `[UsesVerify]` on test class. File: HtmlGeneratorStepDefinitions.cs. (0.0s)



Failed!  - Failed:     1, Passed:     0, Skipped:     0, Total:     1, Duration: < 1 ms - Example.Spec.dll (net6.0)

Did it work fine for you?

@SimonCropp
Copy link
Contributor Author

it seems specflow doesnt support xunits BeforeAfterTestAttribute

@baynezy baynezy merged commit ac4ab96 into baynezy:master May 23, 2022
@baynezy
Copy link
Owner

baynezy commented May 23, 2022

Thank you for your help @SimonCropp I have raised SpecFlowOSS/SpecFlow#2601

Hopefully they can implement it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants