Skip to content

ActionFixture

jochenwierum edited this page Jul 9, 2012 · 1 revision

Action Fixture

The ActionFixture is mostly unchanged. But we added some minor features and a new function to it.

waitFor

In some cases, you want an operation to finish in a given time. waitFor checks this. It does not terminate the process, if it runs too long, but it lets fail the test. waitFor takes 2 or 3 parameters: the method to call repeatedly to check, whether an operation has finished, the maximum timeout, and optionally a sleep time between two method calls.

The method must be public, take zero arguments and must return boolean.

ActionFixture input table

Let's assume, the processing of savedb() works asynchronous, needed ~11 seconds and SaveTest.isSaved() checks, whether the process finished. The output could be:

ActionFixture output table

transformAndEnter

At the moment, most of the SetupFixtures inherit from ActionFixture. To make implementing them easier, transfrormAndEnter() was added. transformAndEnter() calls a method which has the same name as the first cell, passing the second cell as a string parameter:

MyFixture
setAge 18
// in MyFixture.java (which extends ActionFixture):
public void setAge() throws Exception {
    transformAndEnter();
}

will call setAge("18"). This is basically the same as:

MyFixture
enter set age 18
Clone this wiki locally