Is there a way to set the order in which tests are executed within an Spock Specification?
For example:
class MySpec extends IntegrationSpec {
def 'test A'...
def 'test B'...
}
I want 'test A' to be execute always before 'test B'
This is because I'm doing some functional tests with Geb and Spock and data is not rolled back between tests.
By default, Spock runs tests sequentially with a single thread. As of version 2.0, Spock supports parallel execution based on the JUnit Platform.
Spock is a testing and specification framework for Java and Groovy applications. What makes it stand out from the crowd is its beautiful and highly expressive specification language. Thanks to its JUnit runner, Spock is compatible with most IDEs, build tools, and continuous integration servers.
You can use @Stepwise
annotation on a spec and spock will run each of the test definitions of the Spec in the order they are specified. Look at this example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With