We are facing the issue that Xcode detects runtime tests. Because of certain states of the tests these tests will always fail.
It's not possible to get rid of them, by cleaning the Project nor deleting the Derived Data.
Some Test classes are inherited by others.
Specs:
Subclass:
TestClassA: XCTestCase
func testA1()
func testA2()
TestClassB: TestClassA
func testB1()
Now the Problem is that when I run all tests for TestClassB
Xcode will run testB1
and then testA1
and testA2
. Both marked with rt
and they will fail.
How can i achieve that this is not happening by not loosing the subclass structure.
I assume you're overriding the setup and teardown do assure the app will be in the proper state for every test case, the problem here would be that the rT test will appear since the subclasses are inheriting the tests from their parent.
To avoid this while maintaining the subclassing structure, keep the setup and teardown functions in the classes you have but move the tests to a subclass of the setup class.
For example:
Subclass:
TestClassA: XCTestCase
// This one will have the setup and teardown for ATestClassATests: TestClassA
func testA1()
func testA2()
TestClassB: TestClassA
// This one will have the setup and teardown for B, and you may reuse A setupTestClassBTests: TestClassB
func testB1()
func testB2()