DEV Community

Tomas Norre Mikkelsen
Tomas Norre Mikkelsen

Posted on

Codeception tests in Travis CI with DDEV and Selenium

Recently I posted about how to run codeception with DDEV.

This is of course really nice, but having it as part of the CI pipeline is even better.

So I decided to try to make it run within Travis CI which is my preferred public CI at the moment.

What to do?

  1. Signup with travis-ci and registre your repository
  2. Add a .travis.yml to your github repository
  3. Make changes and push, and wait for the results of the tests.

You can see the step in the Travis CI Tutorial

The advantages here is that you will have your behaviour driven tests executed on every commit and pull request, to make sure you or others don't break functionality.

Configuring Travis CI

The .travis.yml is the configuration file for Travis CI. I contains different step and instructions to enable travis to do what you want.

This can be used to run PHPUnit, Checking Coding Standard, Codeception tests and so on, only your imagination is the limit.

This is how the .travis.yml looks like for my

language: php
dist: bionic

    on_success: never
    on_failure: never

  # turn off XDebug for speed up
  - phpenv config-rm xdebug.ini || return 0

  - '7.4'

  - docker

    - $HOME/.composer/cache

  - curl -fsSL | sudo apt-key add -
  - sudo add-apt-repository "deb [arch=amd64] bionic stable"
  - sudo apt update
  - sudo apt install docker-ce
  - sudo curl -L "$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  - sudo chmod +x /usr/local/bin/docker-compose
  - docker-compose --version
  - wget
  - tar vxzf ddev_linux.v1.13.1.tar.gz
  - sudo chmod +x ddev
  - sudo chmod +x mkcert
  - ./mkcert -install

  fast_finish: true
      stage: Tests
      name: "Code ception"
        - composer install
        - ./ddev --version
        - ./ddev start
        - php vendor/bin/codecept run

I had to install a never version of docker, manually to meet the requirements from ddev.

The result

Codeception in Travis CI output console

Have fun.

Top comments (0)