0
这可能很容易/愚蠢,但我找不到它为什么发生。自定义XCTestCase类 - 测试不执行
我创建了一个继承XCTestCase的自定义类。当试图运行测试时,该类中的测试不会被执行。
这是我的课:
@interface TNMediaBarTest : XCTestCase
@end
@implementation TNMediaBarTest
- (void)setUp {
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class. }
- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown]; }
- (void)TNMediaBarLocationButtonTest {
TNMediaBar *mediaBar = [[TNMediaBar alloc] initWithFrame:CGRectZero];
XCTAssertNil(mediaBar.location, @"There's junk in location property after initialization");
[mediaBar locationButtonTapped];
XCTAssertNotNil(mediaBar.location, @"Location is empty after tapping on location button");
[mediaBar locationButtonTapped];
XCTAssertNil(mediaBar.location, @"Location is not empty after tapping on location button a second time"); }
,但我得到:
Executed 0 tests, with 0 failures (0 unexpected) in 0.000 (0.001) seconds
是的,我知道这是这样的事情。谢谢。 –