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

BeforeTestRun resp. AfterTestRun added #2

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

ThiAmm
Copy link

@ThiAmm ThiAmm commented Jun 6, 2016

Methods annotated with BeforeTestRun resp. AfterTestRun will be executed before resp. after the execution of a Examplegraph.

@@ -0,0 +1,13 @@
package ch.unibe.jexample;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this file is missing .java extension.

@akuhn
Copy link
Owner

akuhn commented Jun 13, 2016

Hooray for contributing! 🎀

As mentioned in the issue this implementation might not be safe if a text class has test functions that depend on the return value from another test classes. But otherwise this looks good.

More see inline comments.

@ThiAmm
Copy link
Author

ThiAmm commented Jun 13, 2016

Thanks for your answer.

I currently use methods annotated with "@BeforeClass" to create a directory and put some files in this directoy which will be needed for the the test. Clearly, i do want to delete the directory after running my tests.
So, after running the tests implemented with JExample, i recognized that my test directory still exists although i wrote a method annotated with "@afterclass" where i delete the directory.
After debugging i recognized another issue for me: Assume i haven written two classes A and B in which several tests are declared and a method annotated with "@BeforeClass". Furthermore assume tests in class B depend on tests in class A. When i run class B, the method annotated with "@BeforeClass" in class A might be called instead of the method annotated with "@BeforeClass" in class B. Therefore i created two new annotations "@BeforeTestRun" and "@AfterTestRun" which seem to have the behaviour i am looking for (instead of changing the behaviour of existing annotations).

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

Successfully merging this pull request may close these issues.

2 participants