Smart Gamma use case of implementation Continuous Integration/ Continuous Delivery for Laravel web app, tested by phpunit and Behat, build automation with Jenkins, blue-green deploy on AWS Beanstalk
2. Agile attributes
- Continuous integration with codebase
- Development with autotests
- Continuous feedback
- Bugfix first
- Feature planning & releases
Goals
- Increase development speed
- Increase product quality
- Decrease risk
- Improve feedback
- Increase time-to-market
3. 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
6. 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
14. “Одним только тестированием качества не
добиться. Рецепт получения высокого качества:
смешивайте разработку и тестирование в
блендере, пока они не станут единой
субстанцией.”
“Вся ответственность за качество лежит на
плечах тех, кто пишет код. Разработчик
отвечает за качество всего кода, к которому он
прикасается: пишет, исправляет или вносит
изменения.”
Роли: разработчик, разработчик в тестировании, инженер по тестированию
Типы тестов: лёгкие, средние, долгие, супердолгие
15. 100% покрытие vs избирательное
тестирование
Модульные тесты (лёгкие)
dependencies
amount
Algorithmic
complexity
Mediators
бизнес-логика
Простой код
без
зависимостей
God Object /
Spaghetti
16. Функциональные тесты (средние)
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”
17.
18.
19.
20. 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
21. Etalon Datas
Data loading variation:
- Inline in each test
- Preload before suite
Laravel:
- Seeds / factories
- Organize domain data builders
- Transactions
24. 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)