views:

41

answers:

1

with junit test , how could I start the application software then close it properly and do it for each test ?

  • @test public void test1(){ // start appli //test Jtextfield //close appli }
  • @test public void test2(){ // start appli //test ComboBox //close appli }
  • @test public void test3{ // start appli //test Jbutton //close appli

}

A: 

Generally there are means of doing some action before and after test class / test method passing in junit 4 (see info about @BeforeClass and @BeforeMethod annotations, for example, here: http://junit.sourceforge.net/javadoc/org/junit/BeforeClass.html)

But application starting/stopping behavior looks closer to functionality testing, not unit testing. Probably it would be better not to start and stop whole application, but perform some application reinitialization.

Also, there's perfect functionality testing framework TestNG (http://testng.org), and it also provides means like beforeclass / beforemethod annotations.

Kel
I think my problem comes from managing threads...
laura