Using tags ( Smoke, regression) with TestCafe

Viewed 2305

Using testcafe grep patterns would partially solve our problem of using tags but it would still display those tags on the spec report ...!!!

Is there a way to include tags in the test/fixture names and use grep patterns but skip those tags to be displayed in the execution report ??

import { Selector } from 'testcafe';

fixture `Getting Started`
    .page `http://devexpress.github.io/testcafe/example`;

test('My first test --tags {smoke, regression}', async t => {
    // Test code
});

test('My Second test --tags {smoke}', async t => {
    // Test code
});

test('My first test --tags {regression}', async t => {
    // Test code
});

testcafe chrome test.js -F "smoke" 

The above snippet would trigger the smoke only tests for me though but the report will display the test names along with those tags

Is there an alternative way to deal with tags or a solution to not display the tags in the test execution report?

2 Answers

It appears in a recent release (v0.23.1) of testcafe you can now filter with metadata via the commandline.

You can now run only those tests or fixtures whose metadata contains a specific set of values. Use the --test-meta and --fixture-meta flags to specify these values.

testcafe chrome my-tests --test-meta device=mobile,env=production

or

testcafe chrome my-tests --fixture-meta subsystem=payments,type=regression

Read more at https://devexpress.github.io/testcafe/blog/testcafe-v0-23-1-released.html

Related