I have this test class below, and I want to run only one test from it, for example the "aboutPage". Any ideas how?
This is how I run only this file:
codecept run tests/acceptance/VisitorCest.php
But now I want to run only one test from the file.
<?php use \AcceptanceTester; class VisitorCest { public function _before(){} public function _after(){} public function aboutPage(AcceptanceTester $I) { $I->wantTo('check about page'); } public function contactPage(AcceptanceTester $I) { $I->wantTo('check contact page'); } }
Press p , and then type a filename. Then you can use describe. only and it. only which will skip all other tests from the filtered, tested file.
Cypress provides two ways to test cases. Either using the Cypress UI Test Runner or from the CLI using the "cypress run" command. A specific test case can be executed on the CLI using the "--spec" option. We can change the browser for a specific test run on CLI using the "--browser" option.
You simply append a colon and the function name, like this:
codecept run tests/acceptance/VisitorCest.php:myTestName
or a shorter version:
codecept run acceptance VisitorCest:myTestName
(Notice the space between the suite-name and the file-name.)
this is what works:
codecept run {suite-name} {file-name}.php:{function-name}
notice the space between the suite-name and the file-name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With