Add options to the JUnit module #1002
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The PR adds the mechanisms to have options for the JUnit module. To avoid that the Core module need to know about every option of the JUnit module, the JUnit options is passed through the Core module classes the same way that GCC passes option through to the pre-processor, linker etc. A JUnit option on the command line:
and in
@CucumberOptions:Two JUnit options are added:
--allow-started-ignored--filename-compatible-namesThe
--allow-started-ignoredmakes the JUnit module fire the test started notification before each test step is executed. The current behaviour is to wait to fire the test started notification until after the test step has executed. This is done to be able to not fire the test started notifications for pending steps, for which only the test ignored notification is fired. The rational for the current behaviour is that there are listeners that do not expect a test started to be followed by a test ignored. For instance Eclipse (v4.5 Mars) will report the wrong number of tests executed in that case - for instance "37 out of 36 tests executed". A consequence of the current behaviour is that a listener cannot calculate the execution time of a step from the elapsed time between the test started notification and the test finished notification, see #825.The current behaviour will still be the default behaviour with the PR, but the
--allow-started-ignoredcan be used when it is important that the elapsed time between the test started notification and the test finished notification reflects the execution time of the steps. Closes #825.The
--filename-compatible-namesmakes the JUnit module change the names used for "Execution units"/test cases and test steps in the notifications, so that they on all platforms can be used in file names (the names are actually constrained to [A-Za-z0-9_]). For instance Gradle will use the names of the test cases in report file names, and especially Windows cannot handle all characters in filenames, see #972. In some cases also names of the test steps are used for file names, see http://stackoverflow.com/questions/25174141/could-not-generate-test-report-in-gradle-due-to-cucumber-step-syntax. Fixes #972.