Unit test creation

  • Check when creating a project

  • You can also create test cases in the following ways

A.m test file with the same name as the project is created

  • Create a unit test file yourself

– (void) setUp; // Called before the test starts – (void)tearDown// called after the test ends – (void)testExample// where the test method is written – (void)testPerformanceExample// Tests performance such as for loop time

  • You can also create your own methods that start with test

  • Check this box when creating files that can be used by test cases to reference header files for testing

To begin testing

  • Create a utility class that writes two methods

  • Click Test or Command + U to run the test

  • Test passed successfully

Code coverage

  • Turn on code coverage

  • View code coverage

  • The resources

Blog.csdn.net/sinat_30314…

  • Click to view the number of times the code is called