All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups Pages
TyphoonTestUtils Class Reference

Provides a utility for performing asynchronous integration tests with Typhoon. More...

Inheritance diagram for TyphoonTestUtils:

Class Methods

(void) + wait:secondsForCondition:andPerformTests:
 Waits for a condition to occur, and performs additional tests, also overriding the default timeout with the supplied value. More...
 
(void) + waitForCondition:
 Waits for a condition to occur. More...
 
(void) + waitForCondition:andPerformTests:
 Waits for a condition to occur, and performs additional tests. More...
 

Detailed Description

Provides a utility for performing asynchronous integration tests with Typhoon.

If a method dispatches on a background thread or queue, and responds via a block or delegate, this class can be used to test the the expected response occurred.

Method Documentation

+ (void) wait: (NSTimeInterval)  seconds
secondsForCondition: (TyphoonAsynchConditionBlock condition
andPerformTests: (TyphoonTestAssertionsBlock assertions 

Waits for a condition to occur, and performs additional tests, also overriding the default timeout with the supplied value.

Example:

__block BusinessDetails* result = nil;
[_client requestBusinessDetailsWithSuccess:^(BusinessDetails* businessDetails)
{
result = businessDetails;
}];
[TyphoonTestUtils wait:3 secondsForCondition:^BOOL
{
typhoon_asynch_condition(result != nil);
} andPerformTests:^
{
assertThatBool(businessDetails.goldenEgg, equalToBool:YES);
}];
+ (void) waitForCondition: (TyphoonAsynchConditionBlock condition

Waits for a condition to occur.

The default time-out is seven seconds, which is the current usability standard for remote request round-trips.

+ (void) waitForCondition: (TyphoonAsynchConditionBlock condition
andPerformTests: (TyphoonTestAssertionsBlock assertions 

Waits for a condition to occur, and performs additional tests.