Skip to content

Conversation

@brasmusson
Copy link
Contributor

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:

    --junit,<option>

and in @CucumberOptions:

@CucumberOptions(junit = { <option> })

Two JUnit options are added:

  • --allow-started-ignored
  • --filename-compatible-names

The --allow-started-ignored makes 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-ignored can 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-names makes 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.

brasmusson added 3 commits May 5, 2016 14:57
The --allow-started-ignored option makes the JUnitReporter to always
fire test started before a step is executed, so that the test strated
and test finished notifications can be used to measure the execution
time of the step. In case of pending steps, the test started will be
followed by a test ignored, and that will confuse some listeners.
The --filename-compatible-names makes the JUnitReporter replace
characters other than [A-Za-z0-9_] from the names of "execution units"/
test cases and steps in the notifications so that these can be used in
filenames.
@dkowis
Copy link
Member

dkowis commented May 11, 2016

This is an excellent solution to those two pull requests! I'm gonna merge it!

@dkowis dkowis merged commit 7b72c84 into master May 11, 2016
@clicman
Copy link

clicman commented May 12, 2016

Wow!!! That`s great! Thank you!

@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants