I want to write helper class for my UI tests.
A.swift (Test cases class)
class A:XCTestCase {
//contains test cases, setUp() & tearDown()
...
}
B.swift (Helper class)
Method 1:
class B:XCTestCase {
//only helper functions, no setUp, no tearDown and no test cases
func sampleHelper() {
...
}
...
}
B().sampleHelper()
will call the sampleHelper function (when used within A)
Method 2:
extension XCTestCase {
//only helper functions, no setUp, no tearDown and no test cases
func sampleHelper() {
...
}
...
}
sampleHelper()
will call the helper function (when used within A)
Question:
Which is the optimal method in writing helper classes? I know extension is static but does it really affect the memory/performance if the code base is huge?