@interface QuizUnitTest : SenTestCase
@end
The following code shows an example of defining a test method:
- (void)testDoSomething
{
}
#import <SenTestingKit/SenTestingKit.h>
@interface QuizTests : SenTestCase
@end
@implementation QuizTests
- (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)testMultiplyingTwoNegativeIntegersYieldsPositiveProduct {
int x = -5;
int y = -7;
int product = x * y;
STAssertTrue((product > 0), @"The product was less than zero.");
}
@end
Before Xcode 5
// Put setup code here. This method is called before the invocation of each test method in the class.
Quiz *quiz = [[Quiz alloc] init];
Then add the following test method:
- (void)testNumberofQuestions
{
int count = [quiz.questions count];
STAssertEquals(count, 6, @"Wrong array count");
}
The test should pass.
var target = UIATarget.localTarget();
var app = target.frontMostApp();
var window = app.mainWindow();
target.logElementTree();