vendredi 2 février 2018

Run specific Spock Tests without setup?

In the documentation Spock mentions these function in the section 'Fixture Methods':

def setup() {}          // run before every feature method
def cleanup() {}        // run after every feature method
def setupSpec() {}     // run before the first feature method
def cleanupSpec() {}   // run after the last feature method

I am using the setup function to initialize new objects for all tests. However some tests are supposed to test what happens when there are no other objects yet.

Because of the setup these tests fail now.

Is there any way to suspend the setup for certain functions? An annotation perhaps?

Or do I have to create a separate "setup" function and call them in each test I do. The majority of tests uses it!

Aucun commentaire:

Enregistrer un commentaire