uispecrunner 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -0
- data/VERSION +1 -1
- data/lib/uispecrunner/application.rb +1 -1
- data/src/UISpec+UISpecRunner.h +5 -0
- data/src/UISpec+UISpecRunner.m +41 -3
- data/uispecrunner.gemspec +2 -2
- metadata +3 -3
data/README.md
CHANGED
@@ -34,6 +34,7 @@ to the spec runner. Example:
|
|
34
34
|
- Supports running specs via shell (xcodebuild) or AppleScript (osascript)
|
35
35
|
|
36
36
|
## TODO
|
37
|
+
- Simulator/device switch...
|
37
38
|
- Auto-detect SDK versions available
|
38
39
|
- Support for running specific files
|
39
40
|
- Generate a Kicker script
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
@@ -17,7 +17,7 @@ class UISpecRunner
|
|
17
17
|
end
|
18
18
|
|
19
19
|
# Read standard arguments from uispec.opts
|
20
|
-
options_file = 'uispec.opts'
|
20
|
+
options_file = File.join(Dir.getwd, 'uispec.opts')
|
21
21
|
if File.exists?(options_file)
|
22
22
|
options = UISpecRunner::Options.from_file(options_file).merge(options)
|
23
23
|
end
|
data/src/UISpec+UISpecRunner.h
CHANGED
@@ -16,6 +16,11 @@
|
|
16
16
|
*/
|
17
17
|
+(void)runSpecsConformingToProtocol:(Protocol *)protocol afterDelay:(NSTimeInterval)delay;
|
18
18
|
|
19
|
+
/**
|
20
|
+
* Run all UISpec classes inheriting from a given base class
|
21
|
+
*/
|
22
|
+
+(void)runSpecsInheritingFromClass:(Class)class afterDelay:(NSTimeInterval)delay;
|
23
|
+
|
19
24
|
/**
|
20
25
|
* Infers which set of UISpec classes to run from the following environment variables:
|
21
26
|
* UISPEC_PROTOCOL - Specifies a protocol to run
|
data/src/UISpec+UISpecRunner.m
CHANGED
@@ -6,8 +6,8 @@
|
|
6
6
|
// Copyright 2010 Two Toasters. All rights reserved.
|
7
7
|
//
|
8
8
|
|
9
|
-
#import <objc/runtime.h>
|
10
9
|
#import "UISpec+UISpecRunner.h"
|
10
|
+
#import <objc/runtime.h>
|
11
11
|
|
12
12
|
@interface UISpec ()
|
13
13
|
|
@@ -53,6 +53,43 @@
|
|
53
53
|
[self performSelector:@selector(runSpecClasses:) withObject:specClasses afterDelay:delay];
|
54
54
|
}
|
55
55
|
|
56
|
+
+(NSArray*)specClassesInheritingFromClass:(Class)parentClass {
|
57
|
+
int numClasses = objc_getClassList(NULL, 0);
|
58
|
+
Class *classes = NULL;
|
59
|
+
|
60
|
+
classes = malloc(sizeof(Class) * numClasses);
|
61
|
+
numClasses = objc_getClassList(classes, numClasses);
|
62
|
+
|
63
|
+
NSMutableArray *result = [NSMutableArray array];
|
64
|
+
for (NSInteger i = 0; i < numClasses; i++)
|
65
|
+
{
|
66
|
+
Class superClass = classes[i];
|
67
|
+
do
|
68
|
+
{
|
69
|
+
superClass = class_getSuperclass(superClass);
|
70
|
+
} while(superClass && superClass != parentClass);
|
71
|
+
|
72
|
+
if (superClass == nil)
|
73
|
+
{
|
74
|
+
continue;
|
75
|
+
}
|
76
|
+
|
77
|
+
if ([self isASpec:classes[i]]) {
|
78
|
+
[result addObject:classes[i]];
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
free(classes);
|
83
|
+
|
84
|
+
return result;
|
85
|
+
}
|
86
|
+
|
87
|
+
+(void)runSpecsInheritingFromClass:(Class)class afterDelay:(NSTimeInterval)delay {
|
88
|
+
NSArray* specClasses = [self specClassesInheritingFromClass:class];
|
89
|
+
NSLog(@"Executing Specs: %@", specClasses);
|
90
|
+
[self performSelector:@selector(runSpecClasses:) withObject:specClasses afterDelay:delay];
|
91
|
+
}
|
92
|
+
|
56
93
|
+(void)runSpecsFromEnvironmentAfterDelay:(int)seconds {
|
57
94
|
char* protocolName = getenv("UISPEC_PROTOCOL");
|
58
95
|
char* specName = getenv("UISPEC_SPEC");
|
@@ -68,8 +105,9 @@
|
|
68
105
|
NSLog(@"[UISpecRunner] Running Examples %s on Spec %s", exampleName, specName);
|
69
106
|
[UISpec runSpec:[NSString stringWithUTF8String:specName] example:[NSString stringWithUTF8String:exampleName] afterDelay:seconds];
|
70
107
|
} else if (specName) {
|
71
|
-
NSLog(@"[UISpecRunner] Running Spec %s", specName);
|
72
|
-
|
108
|
+
NSLog(@"[UISpecRunner] Running Spec classes inheriting from %s", specName);
|
109
|
+
Class class = NSClassFromString([NSString stringWithUTF8String:specName]);
|
110
|
+
[UISpec runSpecsInheritingFromClass:class afterDelay:seconds];
|
73
111
|
} else {
|
74
112
|
[UISpec runSpecsAfterDelay:seconds];
|
75
113
|
}
|
data/uispecrunner.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{uispecrunner}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Blake Watters"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-09-16}
|
13
13
|
s.default_executable = %q{uispec}
|
14
14
|
s.description = %q{Provides a simple Ruby interface for running UISpec iPhone tests}
|
15
15
|
s.email = %q{blake@twotoasters.com}
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 1
|
9
|
+
version: 0.3.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Blake Watters
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-09-16 00:00:00 -04:00
|
18
18
|
default_executable: uispec
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|