Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JUnit] Invoke @BeforeClass before TestRunStarted event #1578

Merged

Conversation

mpkorstanje
Copy link
Contributor

Summary

Invoke @BeforeClass before TestRunStarted event

JUnit is running Cucumber so the expectation is that JUnit's
@BeforeClass and @AfterClass methods are invoked respectively before
and after all events emitted by Cucumber. However because the
TestRunStarted event was emitted in the constructor of Cucumber it
would precede the the invocation of @BeforeClass.

In older versions of Cucumber sending the TestSourceRead events was
coupled to reading the test sources. This made it impossible to read the
features ahead of time -required to to create the test description
tree and fail on lexer errors- and send TestRunStarted after
@BeforeClass.

This is no longer case since #1367 and so this problem can be resolved.

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).

Checklist:

  • I've added tests for my code.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@mpkorstanje mpkorstanje force-pushed the run-junit-before-class-before-test-run-started-event branch from 0392d28 to 267e6a3 Compare March 8, 2019 10:26
JUnit is running Cucumber so the expectation is that JUnit's
`@BeforeClass` and `@AfterClass` methods are invoked respectively before
and after all events emitted by Cucumber. However because the
`TestRunStarted` event was emitted in the constructor of `Cucumber` it
would precede the the invocation of `@BeforeClass`.

In older versions of Cucumber sending the `TestSourceRead` events was
coupled to reading the test sources. This made it impossible to read the
features ahead of time -required to to create the test description
tree and fail on lexer errors- and send `TestRunStarted` after
`@BeforeClass`.

This is no longer case since #1367 and so this problem can be resolved.
@mpkorstanje mpkorstanje force-pushed the run-junit-before-class-before-test-run-started-event branch from 267e6a3 to 033c91a Compare March 8, 2019 10:30
@mpkorstanje mpkorstanje merged commit 9782d70 into master Mar 8, 2019
@mpkorstanje mpkorstanje deleted the run-junit-before-class-before-test-run-started-event branch March 8, 2019 10:35
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.005%) to 86.23% when pulling 033c91a on run-junit-before-class-before-test-run-started-event into 0dd53da on master.

@lock
Copy link

lock bot commented Mar 10, 2020

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 Mar 10, 2020
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.

2 participants