API test coverage with Codeception

I’ve never been able to get code coverage to work for my API. I’ve seen quite a few people have problems. Is there actually a way to have API test coverage included in your overall test coverage.

Here is my api.suite.yml

class_name: ApiTester



      - REST:

          depends: PhpBrowser

          part: Json

      - Yii2:

          part: [orm, fixtures]

          configFile: 'config/web.php'



            url: http://reporting.local/api/ 


                CURLOPT_TIMEOUT: 300

Overall codeception.yml


    c3_url: http://reporting.local/c3.php

    enabled: true

    #remote: true


        - models/*

        - controllers/*


All these tests pass when I run without --coverage flags.

I’d read many issues on github on how to get them to work and there doesnt seem to be a robust solution.

If I run with coverage flags I start getting errors for some calls.

[GuzzleHttp\Exception\RequestException] cURL error 56: Recv failure: Connection was reset (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

Some still pass though, but coverage is always 0%.

I’ve seen some people say the REST mnodule is the problem, I’ve removed that before, but then I get all kinds of errors about missing functions.

Has anyone managed to get this coverage working when doing REST API tests?