Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command to run two or multiple tests

How to run two or more tests from a single TestCafe CLI command.

-t "Test name" accepts only one test name.

https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#-t-name---test-name

Requirement:

Want to run selected 10 tests out of 80 available in .js file.

Is there any specific command or pattern available?

like image 795
smvnkt Avatar asked Jan 24 '19 16:01

smvnkt


People also ask

How do I run TestCafe runner?

Use the testCafe. createRunner method to create a Runner . Specifies the browsers in which tests run. Configures the test runner to run tests from the specified locations.

Where is TestCafe installed?

You can install TestCafe from npm globally or locally in your project. Global installation is required to run TestCafe in the command line from any location. For instance, you need to install TestCafe globally to execute the testcafe command from your custom application.

How do I debug TestCafe?

TestCafe provides the t. debug method that pauses the test and allows you to debug it with the browser's developer tools. You can also use the --debug-mode command line option to pause the test before the first action or assertion.


Video Answer


2 Answers

You're correct that -t will only match a test name, but -T (capital) or --test-grep will allow you to match a pattern.

If the tests you want to run are grouped in a fixture, you can also run a particular fixture with -f or a set of fixtures with -F to match a pattern (similar to -T)

like image 127
lostlemon Avatar answered Oct 11 '22 15:10

lostlemon


You can run multiple TestCafe tests using below command, for e.g.

// Matching different search patterns
testcafe -e -u chrome testcafe/tests -T 'pattern1|pattern2|pattern3'

// Matching similar search patterns L0 and L1 using regex
testcafe -e -u chrome testcafe/tests -T 'L[01]'
like image 3
Jitesh Sojitra Avatar answered Oct 11 '22 14:10

Jitesh Sojitra