Get it here or from NuGet for an xunit test project in .NET Core. Decorate classes with:
[FeatureFile("./Mandate.feature")]
Methods with...
[When(@"A mandate check of condition ""(.*)"" is performed")]
...and:
[Then(@"an argument exception shall be thrown")]
Mandate.feature is a .txt file with a bunch of scenarios in it.
Addendum 4/8/2020: What is more...
- The class that runs the tests should inheirt from Feature!
- The .feature files need the "Copy to Output Directory" setting set to "Copy if newer" at the Properties pane.
- [Given(@"a configured HEncoder")] is another decorator.
- [And(@"I chose (\d+) as second number")] after Given is legit too.
- Do NOT have Utf8Json and Gherkin installed. One of these two causes problems.
- If the testing class and the .feature are named the same thing and the .feature is in the root of the project, you do not need the FeatureFile attribute.
No comments:
Post a Comment