简体   繁体   中英

iphone unit test case result shows more failures than test cases

I am trying to write some unit test cases for iPhone app. but the results are little weird. I understand the result but want to know how to get actual No. of test cases failed and passed.

Executed 24 tests, with 29 failures (0 unexpected) in 71.791 (71.819) seconds

This just doesnt make sense. Yes, i Have multiple asserts in one case. it fails more than once, but shouldn't it fail one case only.

STAssertNil(var,@"error not nil"); STFail(@"not implemented yet");

There , this will say Executed 1 Tests, with 2 Failures

How to get Executed 1 Test Case, 1 Failed or Executed 24 Test Cases, 10 Failed, 14 Passed

The Objective C test framework considers 1 tes to be one method in a SenTestCase. While failures count the amount of assertions.

If you want each test to corresponds to one assertion, you will need to place every assertion into it's own test method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM