Install QaApi module

  1. Install QaApi package to the repository with tests:

    $ composer require qadept/codeception-qaapi
  2. Add QaApi command to codeception.yml:

    extensions:
        commands:
            - Codeception\Module\QaApi\Command\Generate
  3. Add QaApi module to the suite file (file functional.suite.yml from the previous example). Its content should look like:

    class_name: FunctionalTester
    modules:
        enabled:
            - \MyTests\Helper\Functional
            - WebDriver:
                url: 'http://myproject.local'
                browser: phantomjs
                window_size: 1280x960
            - Asserts
            - \MyTests\Helper\QaApi:
                url: 'http://myproject.local/qaapi'
                api_key: my_secret_key

    Here "url" is a base URL for API, "api_key" is a key for authorization.

  4. Create a qaapi.json file in directory with your project (directory "projects/MyTests/" from the previous example). This file is using Swagger Specification and will be used for automatical generation of PHP API Client.

  5. Generate PHP API Client and helper classes:

    ./vendor/bin/codecept qaapi:generate -c projects/MyTests
    ./vendor/bin/codecept build -c projects/MyTests

On GitHub you can find an example of repository with tests.