iut 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -0
- data/Gemfile +4 -0
- data/Rakefile +1 -0
- data/bin/iut +2 -0
- data/iut.gemspec +24 -0
- data/lib/iut.rb +17 -0
- data/lib/iut/generator.rb +28 -0
- data/lib/iut/version.rb +4 -0
- data/template/project/iUnitTest/iUnitTest.xcodeproj/project.pbxproj +480 -0
- data/template/project/iUnitTest/iUnitTest/Classes/.do_not_remove_this_directory +0 -0
- data/template/project/iUnitTest/iUnitTest/Tests/.do_not_remove_this_directory +0 -0
- data/template/project/iUnitTest/iUnitTest/en.lproj/InfoPlist.strings +2 -0
- data/template/project/iUnitTest/iUnitTest/iUnitTest-Info.plist +44 -0
- data/template/project/iUnitTest/iUnitTest/iUnitTest-Prefix.pch +14 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/Default.png +0 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/IUTAppDelegate.h +20 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/IUTAppDelegate.m +38 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/IUTDetailView.xib +184 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/IUTMainWindow.xib +732 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/IUTTestView.xib +432 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/Settings.bundle/Japanese.lproj/Root.strings +0 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/Settings.bundle/Root.plist +39 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/Settings.bundle/en.lproj/Root.strings +0 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/AppAgent.h +33 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/AppAgent.m +135 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/AppAgentHelper.h +63 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UINavigationBarBasedTest.h +25 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UINavigationBarBasedTest.m +49 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITabBarAndNavigationBarBasedTest.h +23 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITabBarAndNavigationBarBasedTest.m +42 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITabBarBasedTest.h +25 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITabBarBasedTest.m +50 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITableViewBasedTest.h +23 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITableViewBasedTest.m +57 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITableViewControllerTest.h +22 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITableViewControllerTest.m +44 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UIViewBasedTest.h +21 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UIViewBasedTest.m +52 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UIViewControllerTest.h +63 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UIViewControllerTest.m +162 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/GTMSenTestCase.h +17 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/GTMSenTestCase.m +15 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTAssertion.h +135 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTAssertion.m +216 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTAssertionInfo.h +60 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTAssertionInfo.m +104 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTDetailViewController.h +24 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTDetailViewController.m +81 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTLog.h +14 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTPreference.h +34 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTPreference.m +125 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTResultTableViewCell.h +27 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTResultTableViewCell.m +83 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTResultTableViewController.h +26 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTResultTableViewController.m +193 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTTest.h +74 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTTest.m +127 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTTestRunner.h +66 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTTestRunner.m +449 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTTestRunnerViewController.h +59 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTTestRunnerViewController.m +163 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/NSExceptionExtension.h +21 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/NSExceptionExtension.m +52 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/SenTestAssertion.h +82 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/SourceCodeOpener.h +65 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/SourceCodeOpener.m +176 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/UITableViewControllerTestHelper.h +35 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/isd_logo_60x40.png +0 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/isd_logo_60x40_w.png +0 -0
- data/template/project/iUnitTest/iUnitTest/iunittest/iunittest_icon.png +0 -0
- data/template/project/iUnitTest/iUnitTest/main.m +18 -0
- data/template/project/iUnitTest/script/sync_source.rb +27 -0
- metadata +119 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
//
|
2
|
+
// IUTResultTableViewController.h
|
3
|
+
// iUnitTest
|
4
|
+
//
|
5
|
+
// Created by Katsuyoshi Ito on 09/01/17.
|
6
|
+
// Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <UIKit/UIKit.h>
|
10
|
+
#import "IUTTestRunner.h"
|
11
|
+
#import "IUTDetailViewController.h"
|
12
|
+
|
13
|
+
|
14
|
+
@interface IUTResultTableViewController : UITableViewController {
|
15
|
+
IUTTestRunner *runner;
|
16
|
+
|
17
|
+
IUTDetailViewController *detailViewController;
|
18
|
+
UINavigationController *navigationController;
|
19
|
+
}
|
20
|
+
|
21
|
+
@property (retain) IUTTestRunner *runner;
|
22
|
+
@property (retain, readonly) IUTDetailViewController *detailViewController;
|
23
|
+
|
24
|
+
@property (retain) UINavigationController *navigationController;
|
25
|
+
|
26
|
+
@end
|
@@ -0,0 +1,193 @@
|
|
1
|
+
//
|
2
|
+
// IUTResultTableViewController.m
|
3
|
+
// iUnitTest
|
4
|
+
//
|
5
|
+
// Created by Katsuyoshi Ito on 09/01/17.
|
6
|
+
// Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import "IUTResultTableViewController.h"
|
10
|
+
#import "IUTAssertion.h"
|
11
|
+
#import "IUTResultTableViewCell.h"
|
12
|
+
#import "IUTTestRunnerViewController.h"
|
13
|
+
#import "SourceCodeOpener.h"
|
14
|
+
#import "NSExceptionExtension.h"
|
15
|
+
|
16
|
+
|
17
|
+
@implementation IUTResultTableViewController
|
18
|
+
|
19
|
+
@synthesize runner, navigationController;
|
20
|
+
|
21
|
+
/*
|
22
|
+
- (id)initWithStyle:(UITableViewStyle)style {
|
23
|
+
// Override initWithStyle: if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
|
24
|
+
if (self = [super initWithStyle:style]) {
|
25
|
+
}
|
26
|
+
return self;
|
27
|
+
}
|
28
|
+
*/
|
29
|
+
|
30
|
+
- (void)viewDidLoad {
|
31
|
+
[super viewDidLoad];
|
32
|
+
self.tableView.rowHeight = 100;
|
33
|
+
}
|
34
|
+
|
35
|
+
/*
|
36
|
+
- (void)viewWillAppear:(BOOL)animated {
|
37
|
+
[super viewWillAppear:animated];
|
38
|
+
}
|
39
|
+
*/
|
40
|
+
/*
|
41
|
+
- (void)viewDidAppear:(BOOL)animated {
|
42
|
+
[super viewDidAppear:animated];
|
43
|
+
}
|
44
|
+
*/
|
45
|
+
/*
|
46
|
+
- (void)viewWillDisappear:(BOOL)animated {
|
47
|
+
[super viewWillDisappear:animated];
|
48
|
+
}
|
49
|
+
*/
|
50
|
+
/*
|
51
|
+
- (void)viewDidDisappear:(BOOL)animated {
|
52
|
+
[super viewDidDisappear:animated];
|
53
|
+
}
|
54
|
+
*/
|
55
|
+
|
56
|
+
/*
|
57
|
+
// Override to allow orientations other than the default portrait orientation.
|
58
|
+
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
59
|
+
// Return YES for supported orientations
|
60
|
+
return (interfaceOrientation == UIInterfaceOrientationPortrait);
|
61
|
+
}
|
62
|
+
*/
|
63
|
+
|
64
|
+
- (void)didReceiveMemoryWarning {
|
65
|
+
[super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
|
66
|
+
// Release anything that's not essential, such as cached data
|
67
|
+
}
|
68
|
+
|
69
|
+
#pragma mark Table view methods
|
70
|
+
|
71
|
+
- (NSArray *)resultsForSection:(NSInteger)section
|
72
|
+
{
|
73
|
+
return (section == 0) ? self.runner.fails : self.runner.errors;
|
74
|
+
}
|
75
|
+
|
76
|
+
- (NSException *)resultForIndexPath:(NSIndexPath *)indexPath
|
77
|
+
{
|
78
|
+
return [[self resultsForSection:indexPath.section] objectAtIndex:indexPath.row];
|
79
|
+
}
|
80
|
+
|
81
|
+
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
82
|
+
return 2;
|
83
|
+
}
|
84
|
+
|
85
|
+
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
|
86
|
+
{
|
87
|
+
int count = [[self resultsForSection:section] count];
|
88
|
+
if (section == 0) {
|
89
|
+
return [NSString stringWithFormat:(count <= 1) ? @"%d failure" : @"%d failures", count];
|
90
|
+
} else {
|
91
|
+
return [NSString stringWithFormat:(count <= 1) ? @"%d error" : @"%d errors", count];
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
// Customize the number of rows in the table view.
|
96
|
+
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
97
|
+
NSArray *results = [self resultsForSection:section];
|
98
|
+
return [results count];
|
99
|
+
}
|
100
|
+
|
101
|
+
// Customize the appearance of table view cells.
|
102
|
+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
103
|
+
|
104
|
+
static NSString *CellIdentifier = @"Cell";
|
105
|
+
|
106
|
+
IUTResultTableViewCell *cell = (IUTResultTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
|
107
|
+
if (cell == nil) {
|
108
|
+
cell = [[[IUTResultTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
|
109
|
+
}
|
110
|
+
|
111
|
+
cell.exception = [self resultForIndexPath:indexPath];
|
112
|
+
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
|
113
|
+
|
114
|
+
return cell;
|
115
|
+
}
|
116
|
+
|
117
|
+
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
118
|
+
#if TARGET_IPHONE_SIMULATOR
|
119
|
+
IUTAssertionInfo *info = [self resultForIndexPath:indexPath].assertionInfo;
|
120
|
+
if (info) {
|
121
|
+
[[SourceCodeOpener sourceCodeOpener] open:info];
|
122
|
+
}
|
123
|
+
#endif
|
124
|
+
|
125
|
+
[tableView deselectRowAtIndexPath:[tableView indexPathForSelectedRow] animated:YES];
|
126
|
+
}
|
127
|
+
|
128
|
+
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
|
129
|
+
{
|
130
|
+
self.detailViewController.exception = [[self resultsForSection:indexPath.section] objectAtIndex:indexPath.row];
|
131
|
+
[self.navigationController pushViewController:self.detailViewController animated:YES];
|
132
|
+
}
|
133
|
+
|
134
|
+
/*
|
135
|
+
// Override to support conditional editing of the table view.
|
136
|
+
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
|
137
|
+
// Return NO if you do not want the specified item to be editable.
|
138
|
+
return YES;
|
139
|
+
}
|
140
|
+
*/
|
141
|
+
|
142
|
+
|
143
|
+
/*
|
144
|
+
// Override to support editing the table view.
|
145
|
+
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
|
146
|
+
|
147
|
+
if (editingStyle == UITableViewCellEditingStyleDelete) {
|
148
|
+
// Delete the row from the data source
|
149
|
+
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES];
|
150
|
+
}
|
151
|
+
else if (editingStyle == UITableViewCellEditingStyleInsert) {
|
152
|
+
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
|
153
|
+
}
|
154
|
+
}
|
155
|
+
*/
|
156
|
+
|
157
|
+
|
158
|
+
/*
|
159
|
+
// Override to support rearranging the table view.
|
160
|
+
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
|
161
|
+
}
|
162
|
+
*/
|
163
|
+
|
164
|
+
|
165
|
+
/*
|
166
|
+
// Override to support conditional rearranging of the table view.
|
167
|
+
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
|
168
|
+
// Return NO if you do not want the item to be re-orderable.
|
169
|
+
return YES;
|
170
|
+
}
|
171
|
+
*/
|
172
|
+
|
173
|
+
|
174
|
+
- (void)dealloc {
|
175
|
+
[runner release];
|
176
|
+
[navigationController release];
|
177
|
+
[detailViewController release];
|
178
|
+
[super dealloc];
|
179
|
+
}
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
- (IUTDetailViewController *)detailViewController
|
184
|
+
{
|
185
|
+
if (detailViewController == nil) {
|
186
|
+
detailViewController = [[IUTDetailViewController alloc] initWithNibName:@"IUTDetailView" bundle:nil];
|
187
|
+
}
|
188
|
+
return detailViewController;
|
189
|
+
}
|
190
|
+
|
191
|
+
|
192
|
+
@end
|
193
|
+
|
@@ -0,0 +1,74 @@
|
|
1
|
+
//
|
2
|
+
// iUnitTest.h
|
3
|
+
// iUnitTest
|
4
|
+
//
|
5
|
+
// Created by Katsuyoshi Ito on 09/01/16.
|
6
|
+
// Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <Foundation/Foundation.h>
|
10
|
+
#import "IUTAssertion.h"
|
11
|
+
|
12
|
+
|
13
|
+
@interface IUTTest : IUTAssertion {
|
14
|
+
NSMutableArray *tests;
|
15
|
+
|
16
|
+
NSTimeInterval testAfterDelay;
|
17
|
+
|
18
|
+
SEL nextSetUpSequence;
|
19
|
+
NSTimeInterval nextSetUpSequenceAfterDelay;
|
20
|
+
|
21
|
+
SEL nextTest;
|
22
|
+
NSTimeInterval nextTestAfterDelay;
|
23
|
+
}
|
24
|
+
|
25
|
+
@property (retain, readonly) NSMutableArray *tests;
|
26
|
+
|
27
|
+
/** This properties were deprecated in iPhone OS 3.0. didSetUp method should return delay time. */
|
28
|
+
@property NSTimeInterval testAfterDelay __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA,__MAC_NA,__IPHONE_2_2,__IPHONE_3_0);
|
29
|
+
|
30
|
+
@property SEL nextSetUpSequence;
|
31
|
+
@property NSTimeInterval nextSetUpSequenceAfterDelay;
|
32
|
+
|
33
|
+
@property SEL nextTest;
|
34
|
+
@property NSTimeInterval nextTestAfterDelay;
|
35
|
+
|
36
|
+
/**
|
37
|
+
* Returns a Boolean value that indicates whether to collect tests in super class.
|
38
|
+
* default is NO.
|
39
|
+
* @return YES if collect tests in super class, otherwise NO.
|
40
|
+
*/
|
41
|
+
+ (BOOL)doesCollectTestsInSuper;
|
42
|
+
|
43
|
+
/**
|
44
|
+
* Returns a Boolean value that indicates whether to test even sucessed in RunFailuresOnly setting.
|
45
|
+
* default is NO.
|
46
|
+
* @return YES if force tests in this class, otherwise NO.
|
47
|
+
*/
|
48
|
+
+ (BOOL)forceTestsAnyway;
|
49
|
+
|
50
|
+
|
51
|
+
- (NSNumber *)willSetUp;
|
52
|
+
- (void)setUp;
|
53
|
+
- (NSNumber *)didSetUp;
|
54
|
+
|
55
|
+
- (NSNumber *)willTearDown;
|
56
|
+
- (void)tearDown;
|
57
|
+
- (NSNumber *)didTearDown;
|
58
|
+
|
59
|
+
|
60
|
+
// for delayd sequeces or tests
|
61
|
+
/**
|
62
|
+
* When you call this method in -willSetUp or -setUp or -didSetUp, specified selector will be called after -didSetUp.
|
63
|
+
* If your tests need same sequences, it's helpful.
|
64
|
+
* @see PerformSetUpSequenceTest.m
|
65
|
+
*/
|
66
|
+
- (void)performSetUpSequence:(SEL)selector afterDelay:(NSTimeInterval)delay;
|
67
|
+
|
68
|
+
/**
|
69
|
+
* When you call this method in test methods, specified selector will be called as next delayed test.
|
70
|
+
* @see PerformTestTest.m
|
71
|
+
*/
|
72
|
+
- (void)performTest:(SEL)selector afterDelay:(NSTimeInterval)delay;
|
73
|
+
|
74
|
+
@end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
//
|
2
|
+
// iUnitTest.m
|
3
|
+
// iUnitTest
|
4
|
+
//
|
5
|
+
// Created by Katsuyoshi Ito on 09/01/16.
|
6
|
+
// Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import "IUTTest.h"
|
10
|
+
#import "/usr/include/objc/objc-class.h"
|
11
|
+
|
12
|
+
|
13
|
+
@interface IUTTest(_private)
|
14
|
+
- (void)collectTestsForClass:(Class)klass;
|
15
|
+
- (void)collectTests;
|
16
|
+
@end
|
17
|
+
|
18
|
+
@implementation IUTTest
|
19
|
+
|
20
|
+
@synthesize tests, testAfterDelay;
|
21
|
+
@synthesize nextSetUpSequence, nextSetUpSequenceAfterDelay;
|
22
|
+
@synthesize nextTest, nextTestAfterDelay;
|
23
|
+
|
24
|
+
|
25
|
+
+ (BOOL)doesCollectTestsInSuper
|
26
|
+
{
|
27
|
+
return NO;
|
28
|
+
}
|
29
|
+
|
30
|
+
+ (BOOL)forceTestsAnyway
|
31
|
+
{
|
32
|
+
return NO;
|
33
|
+
}
|
34
|
+
|
35
|
+
- (id)init
|
36
|
+
{
|
37
|
+
self = [super init];
|
38
|
+
if (self) {
|
39
|
+
tests = [NSMutableArray new];
|
40
|
+
[self collectTests];
|
41
|
+
}
|
42
|
+
return self;
|
43
|
+
}
|
44
|
+
|
45
|
+
- (void)dealloc
|
46
|
+
{
|
47
|
+
[tests release];
|
48
|
+
[super dealloc];
|
49
|
+
}
|
50
|
+
|
51
|
+
- (void)collectTestsForClass:(Class)klass
|
52
|
+
{
|
53
|
+
unsigned int count;
|
54
|
+
NSRange range = NSMakeRange(0, [@"test" length]);
|
55
|
+
Method *methods = class_copyMethodList(klass, &count);
|
56
|
+
Method *methodPtr = methods;
|
57
|
+
for (int i = 0; i < count; i++, methodPtr++) {
|
58
|
+
Method aMethod = *methodPtr;
|
59
|
+
NSString *selectorName = NSStringFromSelector(method_getName(aMethod));
|
60
|
+
if ([selectorName compare:@"test" options:NSCaseInsensitiveSearch range:range] == 0) {
|
61
|
+
// if already has selectorName, it will be overrided. Then ignore this methods.
|
62
|
+
if (![tests containsObject:selectorName]) {
|
63
|
+
[tests addObject:selectorName];
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
67
|
+
free(methods);
|
68
|
+
}
|
69
|
+
|
70
|
+
- (void)collectTests
|
71
|
+
{
|
72
|
+
Class rootClass = [IUTTest class];
|
73
|
+
Class klass = [self class];
|
74
|
+
|
75
|
+
[self collectTestsForClass:klass];
|
76
|
+
|
77
|
+
while((klass != rootClass) && [klass doesCollectTestsInSuper]) {
|
78
|
+
klass = [klass superclass];
|
79
|
+
[self collectTestsForClass:klass];
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
|
84
|
+
- (NSNumber *)willSetUp
|
85
|
+
{
|
86
|
+
return [NSNumber numberWithDouble:0.0];
|
87
|
+
}
|
88
|
+
|
89
|
+
- (void)setUp
|
90
|
+
{
|
91
|
+
}
|
92
|
+
|
93
|
+
- (NSNumber *)didSetUp
|
94
|
+
{
|
95
|
+
return [NSNumber numberWithDouble:testAfterDelay];
|
96
|
+
}
|
97
|
+
|
98
|
+
|
99
|
+
- (NSNumber *)willTearDown
|
100
|
+
{
|
101
|
+
return [NSNumber numberWithDouble:0.0];
|
102
|
+
}
|
103
|
+
|
104
|
+
- (void)tearDown
|
105
|
+
{
|
106
|
+
}
|
107
|
+
|
108
|
+
- (NSNumber *)didTearDown
|
109
|
+
{
|
110
|
+
return [NSNumber numberWithDouble:0.0];
|
111
|
+
}
|
112
|
+
|
113
|
+
|
114
|
+
- (void)performSetUpSequence:(SEL)selector afterDelay:(NSTimeInterval)delay
|
115
|
+
{
|
116
|
+
self.nextSetUpSequence = selector;
|
117
|
+
self.nextSetUpSequenceAfterDelay = delay;
|
118
|
+
}
|
119
|
+
|
120
|
+
- (void)performTest:(SEL)selector afterDelay:(NSTimeInterval)delay
|
121
|
+
{
|
122
|
+
self.nextTest = selector;
|
123
|
+
self.nextTestAfterDelay = delay;
|
124
|
+
}
|
125
|
+
|
126
|
+
|
127
|
+
@end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
//
|
2
|
+
// IUTTestRunner.h
|
3
|
+
// iUnitTest
|
4
|
+
//
|
5
|
+
// Created by Katsuyoshi Ito on 09/01/16.
|
6
|
+
// Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <Foundation/Foundation.h>
|
10
|
+
|
11
|
+
|
12
|
+
@interface IUTTestRunner : NSObject {
|
13
|
+
|
14
|
+
NSMutableArray *sites;
|
15
|
+
|
16
|
+
NSMutableArray *tests;
|
17
|
+
NSMutableArray *passes;
|
18
|
+
NSMutableArray *fails;
|
19
|
+
NSMutableArray *errors;
|
20
|
+
|
21
|
+
NSException *exception;
|
22
|
+
|
23
|
+
BOOL stopRequest;
|
24
|
+
|
25
|
+
NSTimeInterval delay;
|
26
|
+
}
|
27
|
+
|
28
|
+
@property (retain, readonly) NSMutableArray *sites;
|
29
|
+
|
30
|
+
@property (retain, readonly) NSMutableArray *tests;
|
31
|
+
@property (retain, readonly) NSMutableArray *passes;
|
32
|
+
@property (retain, readonly) NSMutableArray *fails;
|
33
|
+
@property (retain, readonly) NSMutableArray *errors;
|
34
|
+
|
35
|
+
@property (readonly) int badgeNumber;
|
36
|
+
|
37
|
+
@property (retain) NSException *exception;
|
38
|
+
|
39
|
+
@property (assign, readonly) NSString *result;
|
40
|
+
|
41
|
+
@property (readonly) int assertedCount;
|
42
|
+
|
43
|
+
@property (readonly) BOOL isPassed;
|
44
|
+
@property (readonly) BOOL hasErrors;
|
45
|
+
@property (readonly) BOOL hasFailures;
|
46
|
+
|
47
|
+
@property (assign, readonly) UIColor *successColor;
|
48
|
+
@property (assign, readonly) UIColor *failureColor;
|
49
|
+
@property (assign, readonly) UIColor *failureColor2;
|
50
|
+
@property (assign, readonly) UIColor *errorColor;
|
51
|
+
@property (assign, readonly) UIColor *idleColor;
|
52
|
+
@property (assign, readonly) UIColor *backgroundColor;
|
53
|
+
|
54
|
+
|
55
|
+
+ (UIColor *)successColor;
|
56
|
+
+ (UIColor *)failureColor;
|
57
|
+
+ (UIColor *)failureColor2;
|
58
|
+
+ (UIColor *)errorColor;
|
59
|
+
+ (UIColor *)idleColor;
|
60
|
+
|
61
|
+
|
62
|
+
- (void)run:(id)sender;
|
63
|
+
- (void)stop:(id)sender;
|
64
|
+
|
65
|
+
|
66
|
+
@end
|