High-level Automated System Test Environment Terminology
StoryBook: A StoryBook contains a group of Stories that can all be ran automatically.
Story: A Story is a single test case that is composed of Steps being ran in a certain order.
Step: A Step is the basic unit of a Story. It can perform actions and test the results of said action. If an assertion fails the rest of the Story is aborted and it reports the failure to standard output.
Write a Story
A Story is the central idea in Haste. It represents an acceptance test for a single user story, such as “The user can add a new Widget to the Doodads List.” The Story contains a set of steps that, when run in order, accomplish the task.
Writing a Story is easy. Copy the example template included in the Haste distribution $HASTE_HOME/example/systest/StoryTemplate.java to StoryMyFuction.java. Edit the class name to match your function under test and start writing Steps.
There will be one example step in the StoryTemplate class. The example will be an inner class; however, it does not need to be. Haste allows the Steps to be a class all on its own. (This is very useful for steps that are used in more than one story such as starting the application in which to test.)
Writing a StoryBook
Frequently (read: always) you will find that one Story is simply not enough to adequately test any non-trivial application. This is where a StoryBook comes in handy.
A StoryBook is analogous to a test suite: a collection of individual tests that can be run as a group.
There is a template StoryBook in the $HASTE_HOME/example/systest directory.
You’ll want to change the class name and add some Stories. This can be accomplished in the stories() method by calling the addStory() method (to add a single Story), and by calling the addStoryBook() method (to add another whole suite of Stories).
Writing a Step
This is where all the testing gets done. You implement a runStep() method that will perform the step. You can place all of the familiar old jUnit assertions in the Step.
To make your tests actually do something, you’ll want to have your steps perform useful user actions, such as clicking on buttons, typing input, and opening and closing of windows. For this, you’ll need Droids and Pilots. For information on that, see Advanced Usage of Haste.