美文网首页
单元测试UnitTest

单元测试UnitTest

作者: 一代骄马 | 来源:发表于2017-09-21 16:22 被阅读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,@"测试不通过");

    相关文章

      网友评论

          本文标题:单元测试UnitTest

          本文链接:https://www.haomeiwen.com/subject/iuqtextx.html