I can run the tests by the cmd ''codeceptjs run --steps''. But I wonder if it is possible to run only a single test.
My Case:
In a folder "A" I have my json file and 2 folders: 1 output folder, 1 folder which is called ''tests'' in which you can find the 2 js tests files (A1 and A2 for example).
When I hit the cmd "codeceptjs run --steps" in my cd of Folder A it will run the tests A1 and A2. But now I only want to run the test A2. What command I should use to do that so? Have searched for the answer but can't find it myself:( so hopefully someone can help me!
Thanx in advance for helping:).
Yes, sure, just provide a test name as 3rd parameter.
codeceptjs run . my_test.js
Probably this can be improved so you could specify only test name without a parent dir, I hope this will go in next versions
Is there a way to run multiple files?
I have my tests in a subdirectory and want to run them from my package.json:
{
...
"scripts": {
"start": "nodemon index.js --ignore 'test/' --ignore 'apps/'",
"test": "npm run test:api && npm run test:e2e",
"test:api": "ava test/ava --verbose --timeout 3s",
"test:e2e": "codeceptjs ./test/e2e"
}
...
}
test:e2e is where I'm trying to fire off all tests in ./test/e2e/.
I've tried codeceptjs run test/e2e *.js --debug and other variations.
My codecept.json config is:
{
...
"tests": "./*.js",
"output": "./output",
...
}
Am I missing a trick on how to run all tests in a folder without being in the test root?
And in asking the above I realised the config contains "tests": "./*.js". So specifying only the root test directory did the trick: codeceptjs run test/e2e --steps.
I think for this case you may use --grep parameter. What if you add @api to all test names that include api testing and then execute them as
codecept run --grep "@api"
Btw, I added new page to docs just about command execution options. http://codecept.io/commands/
Hmm didn't see this was in the closed section. Anyways, it worked out, thanx for helping and adding new page to docs.
how can I add more than 1 test file into config file
tests: './testcases/portal/Portal.js', I want to execute 2 test files from different directories
@sumiagar , use a pattern
tests: './testcases/**/*.js'
@sumiagar , use a pattern
tests: './testcases/**/*.js'
Thanks for reply .
I want to run below two files
'./testcases/portal/Portal.js'
'./testcases/settings/settings.js'
testcases have other directories also.
@sumiagar did you find a way to run only those 2 test files and nothing else?
I am having the same problem now where I have many test files but I only want to run 2 of them.
For some reason, using --grep "commonName" is not finding any test files to run...
@ab-step-by-step If you have two test files TestA_test.js and TestB_test.js containing Feature("TestA") and Feature("TestB"), you can run all scenarios in them using codeceptjs run --grep 'TestA|TestB'
Most helpful comment
@sumiagar , use a pattern
tests: './testcases/**/*.js'