-
Notifications
You must be signed in to change notification settings - Fork 2
ActionFixture
The ActionFixture is mostly unchanged. But we added some minor features and a new function to it.
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.
Let's assume, the processing of savedb()
works asynchronous, needed ~11 seconds and SaveTest.isSaved()
checks, whether the process finished. The output could be:
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 |