Sharing step definitions across test suites (BDD)

Last edited on

It is possible share BDD step definitions across test suite via collectStepDefinitions().

For this the file test.py/.js/.rb./etc. of the BDD test cases must be edited, to add an argument to the existing collectStepDefinitions() call,

source(findFile('scripts', 'python/bdd.py'))

setupHooks('../shared/scripts/bdd_hooks.py')

# extra argument added to the end:
collectStepDefinitions('./steps', '../shared/steps', '../../global/steps')

def main():
    testSettings.throwOnFailure = True
    runFeatureFile('test.feature')
test.py of a BDD test case

In addition, the Object Map entries that are used in these steps must also be shared between the test suites: Sharing an Object Map across test suites