-
-
Notifications
You must be signed in to change notification settings - Fork 46
Running scenarios
xBehave.net scenarios can be run using any tooling which is capable of running xUnit.net tests.
This includes, but is not restricted to:
- xunit.console.exe/xunit.console.clr4.exe
- TestDriven.Net
- Resharper
- Visual Studio test runner in VS2012 or later
When an xBehave.net scenario is executed, am xUnit.net test command is generated for each step in the scenario. In order for the scenario to succeed, every step in the scenario must succeed.
As soon as a step in a scenario fails, all remaining steps in the scenario are not executed and are marked as failures. This behaviour can be overridden, see Continuing step execution after failure.
If the example shown in Quickstart is executed using xunit.console.clr4.exe, the html output is as follows:-
Depending on how your test runner works, you may have an equivalent output in a GUI or in the VS console.
As you can see, the name of each test command consists of the containing type name, the scenario name, a three part numeric used for ordering the output (see below) and the step description.
If a step fails, you will see a message identifying that step and all subsequent steps which were also marked as failures. E.g.
------ Test started: Assembly: ClassLibrary1.dll ------
Test 'XBehaveQuickStart.CalculatorFeature.Addition() [01.01.05] Then the answer is 4' failed: Assert.Equal() Failure Expected: 4 Actual: 3
Test 'XBehaveQuickStart.CalculatorFeature.Addition() [01.01.06] And the answer is less than 5' failed: System.InvalidOperationException : Failed to execute preceding step "[01.01.05] Then the answer is 4".
(stack traces redacted)
The three part numeric is used to order the test output and is in the form {method call #}.{isolated step #}.{step #}
.
The first number, (method call #) is incremented for each set of example values passed to the scenario method (see Scenarios with examples). If there are are no example values then this is always 01
.
The second number (isolated step #) is incremented each time an isolated step is encountered and executed (see Isolated steps). If there are no isolated steps then this is always 01
.
The third number (step #) is incremented for each step.