Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I run only one test from a suite?

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');     } } 
like image 471
Tzook Bar Noy Avatar asked Aug 01 '14 06:08

Tzook Bar Noy


People also ask

How do you run only one describe jest?

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.

How do I run a specific test case in Cypress?

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.


2 Answers

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.)

like image 83
Tzook Bar Noy Avatar answered Oct 17 '22 04:10

Tzook Bar Noy


this is what works:

codecept run {suite-name} {file-name}.php:{function-name}

notice the space between the suite-name and the file-name

like image 24
Mahmoud Zalt Avatar answered Oct 17 '22 04:10

Mahmoud Zalt