Applies to CrossBrowserTesting SaaS, last modified on January 19, 2022

Codeception is a Behavioral Driven Development test framework for PHP. With Codeception, and BDD in general for that matter, your tests define how your application should behave in different scenarios.

Get set up

  • Install Composer

    First, make sure you have PHP Dependency Manager Composer installed. You can do this by following the instructions on their download page.

  • Installing Codeception

    Once you have Composer, you can then follow the instructions in step 1 of Codeception’s Quickstart guide, choosing whether to install for reference or global use.

    Once that has been taken care of, clone this repository and use these files as a skeleton for your tests with CrossBrowserTesting using Codeception.

  • Set up Acceptance Test

    In order to run tests through our service, you will need to make changes to the file located at tests/acceptance.suite.yml

    In this file you will need to first specify within the WebDriver the url you are testing. Then within the host field, you will need to provide your email that is associated with your CrossBrowserTesting account where is. After the colon you will need to replace yourauthkey with the authkey associated with your account.

    There is also the option to change your capabilities to rename/re-version your test, extend the max_duration, or change your target browser(s).


    class_name: AcceptanceTester
          - WebDriver:
             url: ''
             host: ''
             port: 80
             browser: chrome
              name: 'Codeception Example'
              build: '1.0'
              browserName: 'Chrome'# request the latest version of chrome
              platform: 'Windows 10'# To specify version, add version: 'desired version'
              record_video: 'true'
              record_network: 'false'

    A CBTCest.php file created in the tests/acceptance folder will run a simple acceptance test using our services.


     //Insert opening php tag
    class CBTCest
        public function tryToTest(AcceptanceTester $I) {
            $I->wantTo('ensure my todo-app works');
            $I->see('Todo App');
            $I->fillField('//*[@id="todotext"]','run your first selenium test');

    To find the os_api_name and browser_api_name that corresponds to your targeted platform, you can go to CrossBrowserTesting's Selenium Page, open the wizard, and watch the capabilities in the sample script change as you select different browsers, or you can parse the os/browser you want out of the JSON response from

If you run into any trouble, visit our Codeception GitHub, or if you have any questions, contact Support.

See Also

Test Frameworks and Tools
About Selenium Testing
Selenium and PHP

Highlight search results