jeudi 27 avril 2017

Junit 4 global setup and teardown

i want a separate class with setup and teardown for my entire tests. i managed to crate a class that do that (its a bit tricky, hope there is a better way...).

but when running a specific test from intellij (right click on the file), the setup class is not called.

this is my setup class

public class BaseTest extends TestCase {

    private final static Logger logger = Logger.getLogger(BaseTest.class);

   @Override
   protected void setUp() throws Exception {
       ///Some setup code ...

   }

    @Override
    protected void tearDown() throws Exception {
        //Put teardown code here 
    }

    @Test
    public void testMethodA() {} // For some reason i must add this method, for my code to run

}

Aucun commentaire:

Enregistrer un commentaire