test suite - TestSuite JUnit -> Each TestCase has same @Before etc -



test suite - TestSuite JUnit -> Each TestCase has same @Before etc -

i'm writing som selenium webdriver tests junit 4.

test cases grouped junit testsuite. each test case (test class) has same @rule @beforetest @aftertest

how can realize in junit testsuite, don't have same code @rule, @beforetest , @aftertest in each test case (class)?

//edit: maybe define abstract testcase class, extend each test case?

you merge code of @rule, @beforetest , @aftertest single rule.

public class themergedrule implements testrule { private final testrule thecurrentrule = ... public statement apply(final statement base, final description description) { homecoming new statement() { thecodeofbefore(); thecurrentrule.apply(base, description); thecodeofafter(); } } public void thecodeofbefore() { ... } public void thecodeofafter() { ... } }

junit test-suite

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -