Running and debugging
A spec file runs as an ordinary JUnit test. The plugin puts the controls in the spec file itself. Thus you can start a feature, a rule, a scenario or one Examples table row from the editor. You can also debug the test in the spec file, and not only in the generated Java code.
Run icons in the gutter
The IDE shows its standard run icon in the gutter beside each Feature:, Rule: and Scenario:
keyword. Click the icon, then select Run or Debug. The IDE runs that element as a JUnit
test.
The test results show the titles from your spec file, and not the names of the Java methods. Thus you can read the results in the words of your spec file.
You do not have to know which class runs the test. Run a feature, a rule or a scenario, and the plugin finds the class.
<A spec file with the standard IDE run icons in the gutter beside the Feature, a Rule and a Scenario keyword, and the menu open on one of them with Run and Debug visible.>
Run of just one Examples row
Each data row of an Examples table has its own run icon in the gutter. Click the icon, then
select Run or Debug. The IDE runs the scenario outline one time, with the values of that
row.
<An Examples table with a run icon in the gutter opposite each data row, no icon opposite the header row, and the Run and Debug menu open on one of the icons.>
Breakpoints on steps
Put a line breakpoint on a step. Start the run in Debug mode, and the run stops at that step. The spec file stays in view, and not the generated Java code. Step over, resume and the Variables view operate as usual. Step into opens the body of the step method.
A breakpoint on a background step stops the run before each scenario. A breakpoint in a scenario outline stops the run one time for each Examples row. If the same step text occurs in more than one scenario, the run stops only at the step that you marked.
<A debug session stopped on a step in the spec file: the step line highlighted, a breakpoint dot in its gutter, and the Variables view below with the debugger toolbar.>
The test results tree
Click a scenario, a rule or the feature in the results tree. The IDE opens the related line in the spec file, and not the generated Java code.
The node keeps its Java identity. Thus Rerun Failed Tests continues to operate. If you run one scenario again from the tree, the run uses the class that you wrote.
<The test results tree with scenario titles as node names, one node selected, and the spec file open beside it at that scenario.>
Gradle run configurations
In a Gradle module the plugin makes a Gradle configuration with a :test --tests … filter. Thus
the test runs with the task graph, the system properties and the classpath of your build. The
filter agrees with the element that you clicked: the class, the nested class or one method. In a
Maven module the plugin makes an ordinary JUnit configuration.