Chapter Contents


3 Cleaning up datastore after tests execution

If your tests need to setup some data before running or the actions performed in a test modify the datastore you obviously want to clear the changes after the test has run so that next test can start with a clean datastore. There is a @ModifiesDatastore Spock extension available as a part of the library that comes to your rescue in such situations.

3.1 Examples

3.1.1 Annotating a feature

If you annotate a feature method then datastore will be cleaned up every time after your feature has been executed. See ModifiesDatastoreOnFeatureSpec for an example.

3.1.2 Annotating a non-stepwise specification

If you annotate a non-stepwise specification then datastore will be cleaned up after every feature execution in that specification. See ModifiesDatastoreOnSpecSpec for an example.

3.1.3 Annotating a stepwise specification

If you annotate a stepwise specification then datastore will be cleaned up only after the execution of the last feature in that specification. See ModifiesDatastoreOnStepwiseSpecSpec for an example.


Gaelyk Functional Test Tools Documentation - 0.2 - December, 2012
Licensed under the Apache License, Version 2.0