Inherits from NSObject
Declared in KIFTestScenario.h

Overview

@class KIFTestScenario

A scenario represents a small, but cohesive unit of testing that usually maps to an available user action, such as logging in, or sending a message. Scenarios are comprised of smaller steps (represented by KIFTestSteps) for discrete interactions, such as tapping a button.

A convenient practice is to add a category on KIFTestScenario which includes factory methods to create the scenarios you want to test. This provides a useful identifier for each scenario via the method name (something like +scenarioToLogInSuccessfully), and also provides an organized place for your application-specific scenarios.

Tasks

Properties

description

@property (nonatomic, retain) NSString *description
Discussion

@property description

This should be a thorough description of what the scenario is testing so that if the test fails it is clear which test it was.

Declared In

KIFTestScenario.h

skippedByFilter

@property (nonatomic, readonly) BOOL skippedByFilter
Discussion

@property skippedByFilter

Set the KIF_SCENARIO_FILTER environment variable to skip all scenarios not matching the variable’s value

Declared In

KIFTestScenario.h

steps

@property (nonatomic, readonly, retain) NSArray *steps
Discussion

@property steps

The steps are instances of KIFTestStep (or a subclass). This method returns all steps, including the steps to set up and the steps to tear down.

Declared In

KIFTestScenario.h

stepsToSetUp

@property (nonatomic, copy) NSArray *stepsToSetUp
Discussion

@property stepsToSetUp

The steps to set up are an array of KIFTestStep (or subclass) instances that will be executed at the beginning of the scenario, before the steps specified in the steps property. When initializing the scenario these steps are defaulted to the steps specified by defaultStepsToSetUp, but may be overridden by setting them directly using this property.

Declared In

KIFTestScenario.h

stepsToTearDown

@property (nonatomic, copy) NSArray *stepsToTearDown
Discussion

@property stepsToTearDown

The steps to tear down are an array of KIFTestStep (or subclass) instances that will be executed at the end of the scenario, after the steps specified in the steps property. When initializing the scenario these steps are defaulted to the steps specified by defaultStepsToTearDown, but may be overridden by setting them directly using this property.

Declared In

KIFTestScenario.h

Class Methods

defaultStepsToSetUp

+ (NSArray *)defaultStepsToSetUp
Discussion

@method defaultStepsToSetUp

When initializing a new scenario these steps are set as the stepsToSetUp on the scenario. These default steps can be set using setDefaultStepsToSetUp:

Return Value

The default setup steps.

Declared In

KIFTestScenario.h

defaultStepsToTearDown

+ (NSArray *)defaultStepsToTearDown
Discussion

@method defaultStepsToTearDown

When initializing a new scenario these steps are set as the stepsToTearDown on the scenario. These default steps can be set using setDefaultStepsToTearDown:

Return Value

The default tear down steps.

Declared In

KIFTestScenario.h

scenarioWithDescription:

+ (id)scenarioWithDescription:(NSString *)description
Discussion

@method scenarioWithDescription

Creates a new instance of the scenario with a given description. As part of creating the instance, @link initializeSteps initializeSteps @/link will be called, so calling this method on a subclass of KIFTestScenario will return a fully initialized scenario.

Parameters

description

A description of what the scenario is testing.

Return Value

An initialized scenario.

Declared In

KIFTestScenario.h

setDefaultStepsToSetUp:

+ (void)setDefaultStepsToSetUp:(NSArray *)steps
Discussion

@method setDefaultStepsToSetUp:

When initializing a new scenario these steps are set as the stepsToSetUp on the scenario.

Parameters

The

default setup steps.

Declared In

KIFTestScenario.h

setDefaultStepsToTearDown:

+ (void)setDefaultStepsToTearDown:(NSArray *)steps
Discussion

@method setDefaultStepsToTearDown:

When initializing a new scenario these steps are set as the stepsToTearDown on the scenario.

Parameters

The

default tear down steps.

Declared In

KIFTestScenario.h

Instance Methods

addStep:

- (void)addStep:(KIFTestStep *)step
Discussion

@method addStep:

Declared In

KIFTestScenario.h

addStepsFromArray:

- (void)addStepsFromArray:(NSArray *)steps
Discussion

@method addStepsFromArray:

Declared In

KIFTestScenario.h

initializeSteps

- (void)initializeSteps
Discussion

@method initializeSteps;

This is lazily called the first time the steps property is accessed. Subclasses can use model information to customize the set of steps that are returned.

Declared In

KIFTestScenario.h