Test Automation and Pipelines One Step at a Time

Test Automation and Pipelines One Step at a Time

Test automation and pipelines one step at a time Antonis Pavlakis @pavlakis Code Unit Tests Possible steps required ● composer install (local environment) ● bin/phpunit -c tests/phpunit/phpunit.xml Unit Tests Possible steps required ● Download composer (CI environment) ● composer install ● bin/phpunit -c tests/phpunit/phpunit.xml Bitbucket Pipelines Pipeline status Cache performance Using a custom Docker image Dockerfile Build Docker image docker build -t docker push phpminds/php:7.2.15 . phpminds/php:7.2.15 Pipeline with custom image Pipeline performance Integration Tests Possible steps required ● composer install (local environment) ● composer reset-db ● composer populate-db ● bin/phpunit -c tests/phpunit/phpunit.xml --group integration Set DB to a known "scripts": { state "reset-db": [ "bin/console doctrine:database:drop --force", "bin/console doctrine:database:create", "bin/console doctrine:schema:update --force" Using composer scripts ], "populate-db": [ "bin/console doctrine:fixtures:load" ] } Docker Compose Update Docker Update Docker image image ● Add mysql client Run integration tests using Docker Compose If docker compose is not already running: docker-compose up --build -d Run tests from inside the running container: docker-compose exec -T phpminds-php sh -c "bin/phpunit -c tests/phpunit/phpunit.xml --group integration" Docker Compose in Steps required ● Install Docker Compose Bitbucket Pipelines ● docker-compose up --build -d ● composer install ● (wait for DB container to start) ● composer reset-db ● composer populate-db ● bin/phpunit -c tests/phpunit/phpunit.xml --group integration Install Docker Compose Check DB connection Putting it all together A build with Docker Compose Environment Variables Using .env ci/assets/env.ci Using .env Managing secrets Using repository variables Acceptance Tests Possible steps required ● composer install ● composer reset-db ● composer populate-db ● bin/behat -c tests/behat/behat.yml Example behat.yml Add pipeline step Thank You Antonis Pavlakis @pavlakis.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    30 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us