Reputation: 4296
I have a test suite and a number of test in there own class files. These are selenium webdriver tests. Each test needs to start the webdriver before they start. How should this be done?
I can have the suite start the webdriver fine from its @BeforeClass. But when i try to run a single test from eclipse the webdriver doesnt start. The tests dont know that they are part of the suite and should run the suites @BeforeClass.
Upvotes: 0
Views: 1114
Reputation: 5096
The single Tests would only run the @BeforeClass of the suite if their class extends the suite.
Due to the fact that that's a senseless relationship I think the solution for your Problem is either to define a BeforeClass in something like a TestFunctions.java file as Superclass for all Testclasses or create BeforeClasses for every single Testclass.
Keep in mind that the @BeforeClass and @Before Annotations of the superclass are executed before the @Before(Class) of the subclass but can be overridden.
Upvotes: 3