What will be discussed:
- Building the process of continuous integration/delivery on the example of a Laravel application;
- The structure of the auto-testing organization;
- Integration of running tests and deploy on Jenkins CI server;
- Employment of Docker in conjunction with AWS ElasticBeanstalk for blue-green deployment.
5. Goal
Use CI/CD not only for big
teams
Initial Conditions
- workstationhealth.com
- Laravel framework
- 3 in house devs
- AWS
- Jira
- bitbucket
- QA/DevOps consulting
8. Feature / task branching GIT flow
Is this CI?
- small team
- short-lived branches
- force integration with develop in the
task branch “in-progress” state
Requirements
17. “Одним только тестированием качества не
добиться. Рецепт получения высокого качества:
смешивайте разработку и тестирование в
блендере, пока они не станут единой
субстанцией.”
“Вся ответственность за качество лежит на
плечах тех, кто пишет код. Разработчик
отвечает за качество всего кода, к которому он
прикасается: пишет, исправляет или вносит
изменения.”
Роли: разработчик, разработчик в тестировании, инженер по тестированию
18. 100% покрытие vs избирательное
тестирование
Модульные тесты (лёгкие)
dependencies
amount
Algorithmic
complexity
Mediators
бизнес-логика
Простой код
без
зависимостей
God Object /
Spaghetti
19. Функциональные тесты (средние)
Attributes
Database connection
Request modeling
Response assertion
Database assertion
Goals
API layer stability
Business logic
Testing code coverage (over unit
testing coverage)
Laravel pros
Easy HOW TO START documentation
Phpunit wrapper
Transaction support “from the box”
20.
21.
22.
23. Testing code coverage
phpdbg – allows get test code coverage faster then
xdebug
find tests/ -name '*Test.php' |
./vendor/liuggio/fastest/fastest -o -p 4 -x phpunit.xml
'phpdbg -qrr ./vendor/phpunit/phpunit/phpunit {} --
coverage-php ./tests/_reports/logs/{n}.cov;'
phpcov – allows merge test coverage from threads
phpdbg -qrr ./vendor/bin/phpcov merge tests/_reports/logs/
--clover tests/_reports/logs/clover.xml
24. Etalon Data
Data loading variation:
- Inline in each test
- Preload before suite
Laravel:
- Seeds / factories
- Organize domain data builders
- Transactions
27. How to get faster feedback?
Goal-keep Limits:
- 5 mins for unit/functional tests
- 20 mins for UI tests
Benchmark for 1 thread
Tests: 632, Assertions: 6765:
5 minutes 21 seconds
Optimizations:
- tests multithreading execution
- seeds reload optimization
- selective build code coverage
(only in development branch)