First of all, remember that which commands are available to you are going to depend on which modules and suites you have loaded. For instance, if you are doing integration tests with the default WordPress enabled YML:
$scenario->skip('your message');
won’t work in a Cest or Test out of the box, but will work in Acceptance.
In fact, generally this command will work with Cept tests [Cepts are usually Acceptance like tests, Cests and Tests are usually PHPUnit like OOP tests]. Also, you need to pass $scenario to your function. This isn’t clearly documented and I can’t get it to work in Cests. Don’t get me started on how bad a choice “$scenario” is as a keyword for a BDD framework! A “scenario” is a keyword in Gherkin referring to what is a “step object” in Codeception. In Codeception it seems to be used as a redundant form of “environment”, even though there are environments, suites, and groups already. Like most of this great framework, the docs and function names need to be redone by native English speakers, for the second time! [remember “web guy”? Damn sexists Europeans! Lol].
If you use the
/**
* @skip
*/
public function myTest(){
//this test is totally ignored
}
Annotation right above your function in a Cest or Test it will be skipped, and won’t even appear in the report. [REALLY skip it]. Use this if you want to compleately hide a test.
If you use the PHPUnit command directly:
public function myTest(){
throw new \PHPUnit_Framework_SkippedTestError('This test is skipped');
//this test will appear as a yellow “skipped” test in the report
}
This will generate a skipped test in the report, will turn yellow in the HTML report [--html]. Use this if you want to skip a test but notice in the report that it’s skipped.