单元测试UnitTest

2017-09-21  本文已影响3人  一代骄马

来源 iOS-使用Xcode自带单元测试UnitTest - 简书

- (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)testExample {

// This is an example of a functional test case.

// Use XCTAssert and related functions to verify your tests produce the correct results.

// 测试用例的例子,注意测试用例一定要test开头

}

- (void)testPerformanceExample {

// This is an example of a performance test case. // 测试性能例子

[self measureBlock:^{

// Put the code you want to measure the time of here.

// 需要测试性能的代码 }];

XCTAssertEqual(result, 100,@"测试不通过");

上一篇下一篇

猜你喜欢

热点阅读