Issue
Let's say I have a test class called testFixtureA
with several methods testA
, testB
, testC
, etc, each with @Test
annotation.
Let's now say I subclass testFixtureA
into class called testFixtureAB
and I don't overwrite anything. testFixtureAB
is empty as for now.
When I run tests from testFixtureAB
, methods testA
, testB
and testC
are executed by test runner because test runner doesn't distinguish between test methods from class and baseclass.
How can I force test runner to leave out tests from baseclass?
Solution
Restructure your test classes.
- If you don't want to use the tests from the baseclass, then don't extend it
- If you need other functionality from the base class, split that class in two - the tests, and the other functionality
Answered By - Bozho
Answer Checked By - Candace Johnson (JavaFixing Volunteer)