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
Post a Comment