Tagging Tests Edit on GitHub

Tagging a Single Test

Want to run just a sub-set of your tests? No problem. Simply decorate your tests with one or more tags:

with(tags("smoke", "fast")).
it("returns -1", () -> {
    // ...
});

Tags can be specified when running Cuppa via Maven using the tags property. For example, to run only the tests with the tag smoke:

mvn -Dtags=smoke test

Alternatively you can run all tests which are not tagged with one or more specific tags. For example, to run all tests except tests tagged with slow:

mvn -DexcludedTags=slow test

If you want more flexibility you can use an expression. For example, to run all the tests with fast tag or with smoke and ui tags excluding all slow tags :

mvn -DgroupsExpression="and(or(fast,and(smoke,ui)),not(slow))"

Tagging a Block of Tests

Similarly you can tag all tests within a describe or when block:

with(tags("smoke")).
when("it is empty", () -> {
    it("returns -1", () -> {
        // ...
    });
});