php - How to execute choice of test cases from multiple test cases -
i want execute few selected test cases class of multiple test cases using php unit ease.
as 1-2 test cases failing bunch of test cases , finding difficult execute whole test suite again these two, there method without adding comment others or copying these 2 methods in different suite.
thanks in advance
you may run single test cases or single test classes suites using --filter cli option:
--filter <pattern> filter tests run.
--filter
runs tests name matches given pattern. pattern can either name of single test or regular expression matches multiple test names.
example
take following example test class blatest
containing test cases testsame
, testelse
in file blatest.php
:
// blatest.php <?php class blatest extends phpunit_framework_testcase { public function testsame() { $this->assertsame(1,1); } public function testelse() { $this->assertsame(1,1); } }
running test cases within blatest
this filter matches test class name.
$ phpunit --filter blatest
running single test case within blatest
this filter matches test case name, indicates run filter across file blatest.php.
$ phpunit --filter testsame blatest.php
Comments
Post a Comment