|
@@ -59,5 +59,53 @@ codecept run functional
|
|
|
codecept run unit
|
|
codecept run unit
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
+Code coverage support
|
|
|
|
|
+---------------------
|
|
|
|
|
+
|
|
|
|
|
+By default, code coverage is disabled in `codeception.yaml` configuration file, you should uncomment needed rows to be able
|
|
|
|
|
+to collect code coverage. You can run your tests and collect coverage with the following command:
|
|
|
|
|
+
|
|
|
|
|
+```
|
|
|
|
|
+#collect coverage for all tests
|
|
|
|
|
+codecept run --coverage-html --coverage-xml
|
|
|
|
|
+
|
|
|
|
|
+#collect coverage only for unit tests
|
|
|
|
|
+codecept run unit --coverage-html --coverage-xml
|
|
|
|
|
+
|
|
|
|
|
+#collect coverage for unit and functional tests
|
|
|
|
|
+codecept run functional,unit --coverage-html --coverage-xml
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+You can see code coverage output under the `tests/_output` directory.
|
|
|
|
|
+
|
|
|
|
|
+###Remote code coverage
|
|
|
|
|
+
|
|
|
|
|
+When you run your tests not in the same process where code coverage is collected, then you should uncomment `remote` option and its
|
|
|
|
|
+related options, to be able to collect code coverage correctly. To setup remote code coverage you should follow [instructions](http://codeception.com/docs/11-Codecoverage)
|
|
|
|
|
+from codeception site.
|
|
|
|
|
+
|
|
|
|
|
+1. install Codeception c3 remote support `composer require "codeception/c3:*"`;
|
|
|
|
|
+
|
|
|
|
|
+2. copy c3.php file under your `web` directory and include;
|
|
|
|
|
+
|
|
|
|
|
+3. include `c3.php` file in your `index-test.php` file before application run, so it can catch needed requests.
|
|
|
|
|
+
|
|
|
|
|
+Configuration options that are used by remote code coverage:
|
|
|
|
|
+
|
|
|
|
|
+- c3_url: url pointing to entry script that includes `c3.php` file, so `Codeception` will be able to produce code coverage;
|
|
|
|
|
+- remote: whether to enable remote code coverage or not;
|
|
|
|
|
+- remote_config: path to the `codeception.yaml` configuration file, from the directory where `c3.php` file is located. This is needed
|
|
|
|
|
+ so that `Codeception` can create itself instance and collect code coverage correctly.
|
|
|
|
|
+
|
|
|
|
|
+By default `c3_url` and `remote_config` setup correctly, you only need to copy and include `c3.php` file in your `index-test.php`
|
|
|
|
|
+
|
|
|
|
|
+After that you should be able to collect code coverage from tests that run through `PhpBrowser` or `WebDriver` with same command
|
|
|
|
|
+as for other tests:
|
|
|
|
|
+
|
|
|
|
|
+```
|
|
|
|
|
+#collect coverage from remote
|
|
|
|
|
+codecept run acceptance --coverage-html --coverage-xml
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
Please refer to [Codeception tutorial](http://codeception.com/docs/01-Introduction) for
|
|
Please refer to [Codeception tutorial](http://codeception.com/docs/01-Introduction) for
|
|
|
more details about writing and running acceptance, functional and unit tests.
|
|
more details about writing and running acceptance, functional and unit tests.
|