Objective-J Test API 0.1.0
|
A single test case. More...
Public Member Functions | |
(void) | - assert:equals: [implementation] |
(void) | - assert:equals:message: [implementation] |
(void) | - assert:matches: [implementation] |
(void) | - assert:notEqual: [implementation] |
(void) | - assert:notEqual:message: [implementation] |
(void) | - assert:notSame: [implementation] |
(void) | - assert:notSame:message: [implementation] |
(void) | - assert:same: [implementation] |
(void) | - assert:same:message: [implementation] |
(void) | - assertFalse: [implementation] |
(void) | - assertFalse:message: [implementation] |
(void) | - assertNoThrow: [implementation] |
(void) | - assertNotNull: [implementation] |
(void) | - assertNotNull:message: [implementation] |
(void) | - assertNull: [implementation] |
(void) | - assertNull:message: [implementation] |
(void) | - assertThrows: [implementation] |
(void) | - assertTrue: [implementation] |
(void) | - assertTrue:message: [implementation] |
(int) | - countTestCases [implementation] |
(CPString) | - description [implementation] |
(void) | - fail [implementation] |
(void) | - fail: [implementation] |
(void) | - failEqual:actual:message: [implementation] |
(void) | - failNotEqual:actual:message: [implementation] |
(void) | - failNotSame:actual:message: [implementation] |
(void) | - failSame:actual:message: [implementation] |
(OJTestResult) | - run [implementation] |
(void) | - run: [implementation] |
(void) | - runBare [implementation] |
(void) | - runTest [implementation] |
(void) | - setUp [implementation] |
(void) | - tearDown [implementation] |
A single test case.
A single test case. This is an abstract superclass that each of your test cases (which are usually in their own separate files and of which each tests one and only one class) should subclass. Each of these test cases have the ability to run seperately.
Example:
OJMoqTest : OJTestCase
... // tests and other files
In order to increase readability, there is a conventional way of writing tests. Each test should be prepended by the word "test" and non-tests should not be prepended by the word "test".
Example:
Before each test, the message "setUp" will be passed to your test. By default, this does nothing but you can override the "setUp" method to do something for your test.
After each test, the message "tearDown" will be passed to your test. By default, this does nothing but you can override the "tearDown" method to do something for your test.
Definition at line 3 of file OJTestCase+Assert.j.
- (void) assert: | (id) | expected | |
equals: | (id) | actual | |
[implementation] |
assertions
assert that the expected value is equal to the actual value
expected | The expected value |
actual | The actual value |
Definition at line 63 of file OJTestCase+Assert.j.
- (void) assert: | (id) | expected | |
equals: | (id) | actual | |
message: | (CPString) | message | |
[implementation] |
assertions
assert that the expected value is equal to the actual value and not equal then report the given message
expected | The expected value |
actual | The actual value |
message | The failure message |
Definition at line 78 of file OJTestCase+Assert.j.
- (void) assert: | (CPString) | aRegex | |
matches: | (CPString) | aString | |
[implementation] |
assertions
assert that the given Regular Expression matches the given string
aRegex | A string that represents a regular expression (e.g. "^(.*)$") |
aString | The string to test the regular expression against |
Definition at line 256 of file OJTestCase+Assert.j.
- (void) assert: | (id) | expected | |
notEqual: | (id) | actual | |
[implementation] |
assertions
assert that the expected value is not equal to the actual value
expected | The expected value |
actual | The actual value |
Definition at line 91 of file OJTestCase+Assert.j.
- (void) assert: | (id) | expected | |
notEqual: | (id) | actual | |
message: | (CPString) | message | |
[implementation] |
assertions
assert that the expected value is not equal to the actual value and if equal then report the given message
expected | The expected value |
actual | The actual value |
message | The failure message |
Definition at line 106 of file OJTestCase+Assert.j.
- (void) assert: | (id) | expected | |
notSame: | (id) | actual | |
[implementation] |
assertions
assert that the expected object and the actual object are not the same object.
expected | The expected value |
actual | The actual value |
Definition at line 147 of file OJTestCase+Assert.j.
- (void) assert: | (id) | expected | |
notSame: | (id) | actual | |
message: | (CPString) | message | |
[implementation] |
assertions
assert that the expected object and the actual object are not the same object. If they are the same, then report the given message.
expected | The expected value |
actual | The actual value |
message | The failure message |
Definition at line 162 of file OJTestCase+Assert.j.
- (void) assert: | (id) | expected | |
same: | (id) | actual | |
[implementation] |
assertions
assert that the expected object and the actual object are the same object.
expected | The expected value |
actual | The actual value |
Definition at line 119 of file OJTestCase+Assert.j.
- (void) assert: | (id) | expected | |
same: | (id) | actual | |
message: | (CPString) | message | |
[implementation] |
assertions
assert that the expected object and the actual object are the same object. If they are different, then report the given message.
expected | The expected value |
actual | The actual value |
message | The failure message |
Definition at line 134 of file OJTestCase+Assert.j.
- (void) assertFalse: | (BOOL) | condition | [implementation] |
assertions
assert that the given condition is false
condition | The condition to verify |
Definition at line 37 of file OJTestCase+Assert.j.
- (void) assertFalse: | (BOOL) | condition | |
message: | (CPString) | message | |
[implementation] |
assertions
assert that the given condition is false and if not false then report the given message
condition | The condition to verify |
message | The failure message |
Definition at line 50 of file OJTestCase+Assert.j.
- (void) assertNoThrow: | (Function) | zeroArgClosure | [implementation] |
assertions
assert that the zero argument closure that is given does not throw an exception.
zeroArgClosure | The zero argument closure that will be run. |
Example:
[self assertNoThrow:function(){[myObject myMessage:myArgument];}];
Definition at line 227 of file OJTestCase+Assert.j.
- (void) assertNotNull: | (id) | object | [implementation] |
assertions
assert that the given object is not null.
object | The given object |
Definition at line 198 of file OJTestCase+Assert.j.
- (void) assertNotNull: | (id) | object | |
message: | (CPString) | message | |
[implementation] |
assertions
assert that the given object is not null. If it is null, report the given message.
object | The given object |
message | The failure message |
Definition at line 211 of file OJTestCase+Assert.j.
- (void) assertNull: | (id) | object | [implementation] |
assertions
assert that the given object is null
object | The given object |
Definition at line 174 of file OJTestCase+Assert.j.
- (void) assertNull: | (id) | object | |
message: | (CPString) | message | |
[implementation] |
assertions
assert that the given object is null. If it is not null, report the given message.
a | parameter |
Definition at line 186 of file OJTestCase+Assert.j.
- (void) assertThrows: | (Function) | zeroArgClosure | [implementation] |
assertions
assert that the zero argument closure that is given does throw an exception.
zeroArgClosure | The zero argument closure that will be run. |
Example:
[self assertThrows:function(){[myObject myMessage:myArgument];}];
Definition at line 243 of file OJTestCase+Assert.j.
- (void) assertTrue: | (BOOL) | condition | [implementation] |
OJAssertions
assert that the given condition is true
condition | The condition to verify |
Definition at line 12 of file OJTestCase+Assert.j.
- (void) assertTrue: | (BOOL) | condition | |
message: | (CPString) | message | |
[implementation] |
assertions
assert that the given condition is true and if it is not report the given message
condition | The condition to verify |
message | The failure message |
Definition at line 25 of file OJTestCase+Assert.j.
- (int) countTestCases | [implementation] |
- (CPString) description | [implementation] |
Definition at line 114 of file OJTestCase.j.
- (void) fail | [implementation] |
- (void) fail: | (CPString) | message | [implementation] |
assertions
Fails the test case and reports the given message.
message | The failure message |
Definition at line 278 of file OJTestCase+Assert.j.
- (void) failEqual: | (id) | expected | |
actual: | (id) | actual | |
message: | (CPString) | message | |
[implementation] |
Definition at line 293 of file OJTestCase+Assert.j.
- (void) failNotEqual: | (id) | expected | |
actual: | (id) | actual | |
message: | (CPString) | message | |
[implementation] |
Definition at line 298 of file OJTestCase+Assert.j.
- (void) failNotSame: | (id) | expected | |
actual: | (id) | actual | |
message: | (CPString) | message | |
[implementation] |
Definition at line 288 of file OJTestCase+Assert.j.
- (void) failSame: | (id) | expected | |
actual: | (id) | actual | |
message: | (CPString) | message | |
[implementation] |
Definition at line 283 of file OJTestCase+Assert.j.
- (OJTestResult) run | [implementation] |
Runs the tests and returns the result.
Definition at line 46 of file OJTestCase.j.
- (void) run: | (OJTestResult) | result | [implementation] |
Informs the OJTestResult to run the tests
result | The OJTestResult that will run the tests |
Definition at line 57 of file OJTestCase.j.
- (void) runBare | [implementation] |
Runs the setup, test and teardown for the
a | parameter |
Definition at line 66 of file OJTestCase.j.
- (void) runTest | [implementation] |
- (void) setUp | [implementation] |
SetUp method that is called before each run.
Definition at line 93 of file OJTestCase.j.
- (void) tearDown | [implementation] |
TearDown method that is called after each run.
Definition at line 100 of file OJTestCase.j.