With Junit4, I tried to write a test (.class) that contains 3 @test and need to open the app in each test.
So in the function init that start the app and close it:
@BeforeClass
public static void setupOnce() {
final Thread thr开发者_StackOverflow中文版ead = new Thread() {
public void run() {
//start the appli in the main
thread.start();
}
}
}
@AfterClass
public static void CloseAppli() {
closeAppli();
}
In my testClass: TestButtons.java
I want to start the appli in each @test which is not possible...
Any idea?
It seems what you're looking for is the @After method. That's called after every individual test. @AfterClass is only called once at the ending of ALL the tests.
http://junit.sourceforge.net/javadoc/org/junit/After.html
精彩评论