[ad_1]
Can I have shared states in a XCTestCase class?
class Tests: XCTestCase {
var person: Person!
override func setUp() {
person = Person()
}
override func tearDown() {
person = nil
}
func testExample() {
print("✅ testExample")
print(person)
XCTAssertTrue(true)
}
func testExample2() {
print("✅ testExample2")
print(person)
XCTAssertTrue(true)
}
}
For example in the above code I know that person object is different in the different test methods, but is it possible to have same memory location for person object in both the test methods?
[ad_2]