Permalink
Browse files

Adding test case

  • Loading branch information...
1 parent 3efacc0 commit 459331d299df43cc6fc54a707bbb08c113bf9a33 @gabriel gabriel committed Mar 22, 2009
Showing with 74 additions and 8 deletions.
  1. +15 −0 CHANGELOG.md
  2. +12 −8 README.markdown → README.md
  3. +20 −0 Tests/GHRegisterTestCaseClassTest.m
  4. +13 −0 Tests/GHSpecialTestCase.h
  5. +14 −0 Tests/GHSpecialTestCase.m
View
15 CHANGELOG.md
@@ -0,0 +1,15 @@
+# Release TBD (0.3.1)
+
+## 2008-03-22
+- Renamed TEST_CLI to GHUNIT_CLI
+- Removing main from target; Projects should specify their own test target main.
+- Added test for special registered test case classes
+
+## 2008-03-21
+- Renamed Examples/MyTestable to MyTestable-IPhone
+
+## 2008-03-19
+- Commented a bunch of the code
+- Renamed GHTestUtils to GHTesting
+
+
View
20 README.markdown → README.md
@@ -9,15 +9,18 @@ For example, your test cases will be run if they subclass any of the following:
- SenTestCase
- GTMTestCase
-(Although you can register additional classes at runtime; if you have your own.)
+Although you can register additional classes at runtime; if you have your own. For example,
+
+ [[GHTesting sharedInstance] registerClassName:@"MySpecialTestCase"]
+
## Download
-**GHUnit.framework** [GHUnit-0.2.10.zip](http://rel.me.s3.amazonaws.com/gh-unit/GHUnit-0.2.10.zip) (2009/03/03)
+**GHUnit.framework** [GHUnit-0.3.1.zip](http://rel.me.s3.amazonaws.com/gh-unit/GHUnit-0.3.1.zip) (2009/03/22)
-_A GHUnitTestMain is now included for Mac OS X application testing. You may need to remove your existing test main._
+_For Mac OS X application testing, since 0.3.1, the GHUnitTestMain.m is _NOT_ included._
-_For an iPhone application, you have to embed the source in your project. See below._
+_For an iPhone application testing, you have to embed the source in your project. See below._
## Group
@@ -48,6 +51,7 @@ To add `GHUnit.framework` to your project:
- Add a linked library, select your project.
- Add a direct dependency, and select your project. (This will cause your application or framework to build before the test target.)
+- Create a "test main". You can use the default [GHUnitTestMain.m](http://github.com/gabriel/gh-unit/tree/master/Classes-MacOSX/GHUnitTestMain.m)
- Now create a test (either by subclassing `SenTestCase` or `GHTestCase`). Add it to your test target.
For example `MyTest.m`:
@@ -161,15 +165,15 @@ To run the tests from the command line:
- To the `Tests` target, Add | New Build Phase | New Run Script Build Phrase
- Enter in the path to the RunTests.sh file. (The path should be relative to the xcode project file!)
-From the command line, run the tests from xcodebuild (with the TEST_CLI environment variable set) :
+From the command line, run the tests from xcodebuild (with the GHUNIT_CLI environment variable set) :
// For mac app
- TEST_CLI=1 xcodebuild -target Tests -configuration Debug -sdk macosx10.5 build
+ GHUNIT_CLI=1 xcodebuild -target Tests -configuration Debug -sdk macosx10.5 build
// For iPhone app
- TEST_CLI=1 xcodebuild -target Tests -configuration Debug -sdk iphonesimulator2.2 build
+ GHUNIT_CLI=1 xcodebuild -target Tests -configuration Debug -sdk iphonesimulator2.2 build
-If you are wondering, the `RunTests.sh` script will only run the tests if the env variable TEST_CLI is set.
+If you are wondering, the `RunTests.sh` script will only run the tests if the env variable GHUNIT_CLI is set.
This is why this phase is ignored when running the test GUI. This is how we use a single Test target for both the GUI and command line testing.
Example Makefiles:
View
20 Tests/GHRegisterTestCaseClassTest.m
@@ -0,0 +1,20 @@
+//
+// GHRegisterTestCaseClassTest.m
+// GHUnit
+//
+// Created by Gabriel Handford on 3/21/09.
+// Copyright 2009. All rights reserved.
+//
+
+#import "GHSpecialTestCase.h"
+
+@interface GHRegisterTestCaseClassTest : GHSpecialTestCase {}
+@end
+
+@implementation GHRegisterTestCaseClassTest
+
+- (void)test {
+
+}
+
+@end
View
13 Tests/GHSpecialTestCase.h
@@ -0,0 +1,13 @@
+//
+// GHSpecialTestCase.h
+// GHUnit
+//
+// Created by Gabriel Handford on 3/22/09.
+// Copyright 2009. All rights reserved.
+//
+
+@interface GHSpecialTestCase : NSObject {
+
+}
+
+@end
View
14 Tests/GHSpecialTestCase.m
@@ -0,0 +1,14 @@
+//
+// GHSpecialTestCase.m
+// GHUnit
+//
+// Created by Gabriel Handford on 3/22/09.
+// Copyright 2009. All rights reserved.
+//
+
+#import "GHSpecialTestCase.h"
+
+
+@implementation GHSpecialTestCase
+
+@end

0 comments on commit 459331d

Please sign in to comment.