0

I have few tests that took a considerable long time as few jobs are initiated at the backend side which takes quite long. I want to have some control so that I can run all tests as part of my regression suite except these few long-running tests.

I do not want to specify metadata on all the tests, it would be great if I can add metadata on long-running tests and somehow run all tests except that metadata.

Let's say I add metadata on long-running tests as longRunning=true and I can run tests with some command like : node node_modules/testcafe/bin/testcafe not --test-meta longRunning=true

Is there any way to execute all tests other than this metadata longRunning=true

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47
Jn Neer
  • 245
  • 1
  • 14

2 Answers2

1

You can't do it (as of December 2020) as part of the command, but you can do it programatically, which is described here: https://devexpress.github.io/testcafe/documentation/reference/testcafe-api/runner/filter.html

pavelsaman
  • 7,399
  • 1
  • 14
  • 32
  • 1
    @Jn Neer Here is a detailed example illustrating to do this: [https://stackoverflow.com/questions/55620995/is-it-possible-to-use-the-testcafe-meta-object-to-skip-tests-running-from-the-c](https://stackoverflow.com/questions/55620995/is-it-possible-to-use-the-testcafe-meta-object-to-skip-tests-running-from-the-c) – Alex Kamaev Dec 25 '20 at 07:04
0

Additionally, there is another way provided by TestCafe to skip specific tests, which is the skip method:

fixture `My test fixture`
.page`https://www.my-test-page-com`;

  test('Test 1', () => {}); // This test will run
  test.skip('Test 2', () => {}); // This test will be skipped
  test('Test 3', () => {}); // This test will run too
Martin H.
  • 538
  • 1
  • 7
  • 21