I am using Xcode version - Version 9.4.1 (9F2000).
I am trying to create custom logs for tests running with XCUITest by overwriting XCTestObservation class and registering it with test class.
Observer class: TestObserver
class TestObserver : NSObject, XCTestObservation {
public func testSuiteWillStart(_ testSuite: XCTestSuite) {
print("I am inside function testSuiteWillStart --> \(testSuite)")
} }
Setup in my test case:
class MyTestCase: XCTestCase{
override class func setUp() {
super.setUp()
XCTestObservationCenter.shared.addTestObserver(TestObserver())
}}
I tried running test using Xcode and Fastlane both but the function testSuiteWillStart is not getting called at all. Has anyone faced similar issue?