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

Document test execution lifecycle regarding user code and extensions #149

Closed
2 tasks done
ptahchiev opened this issue Feb 6, 2016 · 10 comments
Closed
2 tasks done

Comments

@ptahchiev
Copy link

ptahchiev commented Feb 6, 2016

Related Issues

Deliverables

  • Document test execution lifecycle regarding user code (i.e., test classes, test methods, before methods, and after methods) and extensions in the User Guide
  • Add a diagram to the User Guide to visualize test lifecycle and where extensions are called.

Original Issue Description

Hello,

I'm using JUnit 4.12 and I have a bunch of selenium tests. All I want is to have a rule that captures a screenshot when the test fails. Just like this guy here:

http://stackoverflow.com/questions/12078982/apply-rule-after-each-test-and-before-each-after-in-junit

Apparently it is not possible to do this with JUnit 4.x Rule because in my @After methods I logout the user and they see the homepage. So when tests fail I always get screenshots of homepage, rather than the page that broke the tests.

I'm reading now about Exception handling extension points here:

http://junit-team.github.io/junit5/

but to me it is still not clear if these extension points will be executed after the @BeforeEach and before the @AfterEach. Can you please clarify that?

Thanks.

@jlink
Copy link
Contributor

jlink commented Feb 6, 2016

Your assumption is correct. ExceptionHandlerExtensionPoints will be invoked first thing if a test method fails.

Am 06.02.2016 um 09:59 schrieb Petar Tahchiev [email protected]:

Hello,

I'm using Junit 4.12 and I have a bunch of selenium tests. All I want is to have a rule that captures a screenshot when the test fails. Just like this guy here:

http://stackoverflow.com/questions/12078982/apply-rule-after-each-test-and-before-each-after-in-junit

Apparently it is not possible to do this with JUnit 4.x Rule because in my @after methods I logout the user and they see the homepage. So when tests fail I always get screenshots of homepage, rather than the page that broke the tests.

I'm reading now about Exception handling extension points here:

http://junit-team.github.io/junit5/

but to me it is still not clear if these extension points will be executed after the @before and before the @after. Can you please clarify that.

Thanks.


Reply to this email directly or view it on GitHub.

@marcphilipp
Copy link
Member

Does this need better documentation?

@marcphilipp marcphilipp added this to the 5.0 M1 milestone Feb 10, 2016
@sbrannen
Copy link
Member

@marcphilipp, yes, this definitely needs to be fully documented. In general, we will eventually need to document the order in which all extension points are executed with regard to each other, possible interactions, etc.

FYI: I just changed the title of this issue accordingly.

@sbrannen sbrannen changed the title [question] Exception handling extension points Document exception handling extension point invocation relative to other extension points Feb 10, 2016
@jlink
Copy link
Contributor

jlink commented Mar 8, 2016

Before putting more effort into documenting extension points and their relative orders, we should first commit to an ordering approach (see #135) and a general approach regarding an invocation extension point (see #157).

@marcphilipp
Copy link
Member

Team decision: Add diagram to user guide to visualize test lifecycle and where extensions are called.

@sbrannen
Copy link
Member

Currently slated for M2.

@sbrannen sbrannen changed the title Document exception handling extension point invocation relative to other extension points Document exception handling extension invocation relative to other extensions Jul 5, 2016
@sbrannen sbrannen modified the milestones: 5.0 M2, 5.0 M3 Jul 15, 2016
@sbrannen sbrannen changed the title Document exception handling extension invocation relative to other extensions Document test execution lifecycle regarding user code, extensions, and engines Jul 24, 2016
@sbrannen
Copy link
Member

FYI: I added Related Issues and Deliverables sections to this issue's description and changed the title to reflect the intended scope.

@marcphilipp marcphilipp modified the milestones: 5.0 M3, 5.0 M4 Oct 11, 2016
@marcphilipp marcphilipp changed the title Document test execution lifecycle regarding user code, extensions, and engines Document test execution lifecycle regarding user code and extensions Jan 5, 2017
@mmerdes
Copy link
Contributor

mmerdes commented Mar 30, 2017

in progress

mmerdes pushed a commit that referenced this issue Mar 31, 2017
sbrannen added a commit that referenced this issue Mar 31, 2017
@marcphilipp marcphilipp modified the milestones: 5.0 M4, 5.0 M5 Apr 1, 2017
@sbrannen
Copy link
Member

Ummm.... wasn't this resolved in 5.0 M4?

@marcphilipp marcphilipp modified the milestones: 5.0 M4, 5.0 M5 Apr 19, 2017
@marcphilipp
Copy link
Member

From a user perspective: yes. Technically, M4 still contained the broken Keynote file that @mmerdes removed later. I changed it anyway 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants