GHTestSuite Class Reference
Inherits from | GHTestGroup : NSObject |
Declared in | GHTestSuite.h GHTestSuite.m |
Overview
Test suite is an alias for test group.
A test case is an instance of a test case class with test methods. A test is a idGHTest which represents a target and a selector. A test group is a collection of tests; A collection of idGHTest (GHTest or GHTestGroup).
For example, if you have 2 test cases, GHTestCase1 (with some test methods) and GHTestCase2 (with some test methods), your test suite might look like:
“Tests” (GHTestSuite) GHTestGroup (collection of tests from GHTestCase1)
- (void)testA1 (GHTest with target GHTestCase1 + testA1)
- (void)testA2 (GHTest with target GHTestCase1 + testA2)
GHTestGroup (collection of tests from GHTestCase2)
- (void)testB1; (GHTest with target GHTestCase2 + testB1)
- (void)testB2; (GHTest with target GHTestCase2 + testB2)
Tasks
-
– initWithName:testCases:delegate:
Create test suite with test cases.
-
+ allTests
Creates a suite of all tests. Will load all classes that subclass from GHTestCase, SenTestCase or GTMTestCase (or register test case class).
-
+ suiteWithTestFilter:
Create suite of tests with filter. This is useful for running a single test or all tests in a single test case.
-
+ suiteWithPrefix:options:
Create suite of tests that start with prefix.
-
+ suiteWithTestCaseClass:method:
Suite for a single test/method.
-
+ suiteFromEnv
Return test suite based on environment (TEST=TestFoo/foo)
Class Methods
allTests
Creates a suite of all tests. Will load all classes that subclass from GHTestCase, SenTestCase or GTMTestCase (or register test case class).
+ (GHTestSuite *)allTests
Return Value
Suite
Declared In
GHTestSuite.h
suiteFromEnv
Return test suite based on environment (TEST=TestFoo/foo)
+ (GHTestSuite *)suiteFromEnv
Return Value
Suite
Declared In
GHTestSuite.h
suiteWithPrefix:options:
Create suite of tests that start with prefix.
+ (GHTestSuite *)suiteWithPrefix:(NSString *)prefix options:(NSStringCompareOptions)options
Parameters
- prefix
If test case class starts with the prefix; If nil or empty string, returns all tests
- options
Compare options
Declared In
GHTestSuite.h
suiteWithTestCaseClass:method:
Suite for a single test/method.
+ (GHTestSuite *)suiteWithTestCaseClass:(Class)testCaseClass method:(SEL)method
Parameters
- testCaseClass
Test case class
- method
Method
Return Value
Suite
Declared In
GHTestSuite.h
suiteWithTestFilter:
Create suite of tests with filter. This is useful for running a single test or all tests in a single test case.
+ (GHTestSuite *)suiteWithTestFilter:(NSString *)testFilter
Parameters
- testFilter
Test filter
Return Value
Suite
Discussion
For example, ‘GHSlowTest’ — Runs all test method in GHSlowTest ‘GHSlowTest/testSlowA — Only runs the test method testSlowA in GHSlowTest
Declared In
GHTestSuite.h
Instance Methods
initWithName:testCases:delegate:
Create test suite with test cases.
- (id)initWithName:(NSString *)name testCases:(NSArray *)testCases delegate:(id<GHTestDelegate>)delegate
Parameters
- name
Label to give the suite
- testCases
Array of init'ed test case classes
- delegate
Delegate
Declared In
GHTestSuite.h