Skip to content

Execution Groups

mplorentz edited this page May 7, 2015 · 1 revision

Execution Groups are a simple construct that are used to limit the number of failures in a group of test functions to one. Often, if one test in a sequence of tests fail there is no point in executing the subsequent tests, either because they too will fail or because their results will not be conclusive. To signify this to the test runner use the "@execution_group" decorator and pass it some unique "id" that identifies that resource group. The "id" can be any type that responds to the "==" operator, and any two execution group decorators with the same id will add their decorated methods to the same execution group. An example:

from egautotest.execution_groups import execution_group
from egautotest.testset import SequentialTestSet
 
@execution_group("FooCreationExecutionGroup")
class TestFooCreation(SequentialTestSet):
    def testOpenFooPage(self):
        assert(True)
    def testClickCreateFooButton(self):
        assert(False)
    def testFooWasCreated(self):
        assert(True)

In this example we have a class that tests the creation of an object Foo. To test creating a Foo, one must open the Foo webpage, click the "create" button, and then verify that the Foo was created. If any one of these steps fail it is pointless to run the next step. So we have added the @execution_group decorator with the id "FooCreationExecutionGroup". If one of the test methods fails when this class is run the remaining test methods will be skipped.

The execution_group decorator can also be applied to functions and works across classes and modules.

You can’t perform that action at this time.