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

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -