CI / CD w/ Codeception
-
Upload
tudor-barbu -
Category
Software
-
view
698 -
download
3
Transcript of CI / CD w/ Codeception
CI / CD with Codeception
Tudor Barbu@motanelu || @CodeVoyagers
#phpbcn
Development Quality Assurance Delivery
Code freeze*
Estimated time
* this how you know you’re old
Development Quality Assurance
More development QA again Nervous
breakdownLast minute
fixes Delivery
Estimated time Estimated time
Code freeze The “real” code freeze 3rd time’s a charm
Almost doneMeanwhile
in reality
Software as a Product
Software as a Service
Development Delivery Observation Decide on
next features
Rinse and repeat
1 – 4 weeks iterations
You’re not really agile!
it takes 1 more week to release you have parallel sprints new iterations break existing functionality you have “bug fixing” sprints or other such practices…
However if
Development INT tests Merge to master
Deploy to stg/pre
Deploy to prod
Continuous Integration
Continuous Delivery
Continuous Deployment
http://phpunit.dePHP unit testing framework
https://github.com/padraic/mockery
When tested individually, units of code are not guaranteed to work together
Functional tests*
run without a web server bootstrap the framework with the required $_* variables may yield false results when the framework’s
specifications are not followed to the letter
* in this context
Acceptance testing
emulate RL (server & browser) PhpBrowser – cURL & crawl Selenium Webdriver PhantomJS
$ composer global require codeception/codeception$ export PATH="$PATH:$HOME/.composer/vendor/bin”$ cd /path/to/project$ codecept bootstrap$ codecept run
Installation
*should* work!
github.com/motanelu/ci-codecpt-example
$ codecept generate:cept acceptance FirstPage$ vim tests/acceptance/FirstPageCept.php$ codecept run
<?php $I = new AcceptanceTester($scenario); $I->wantTo('See what the fuss is about'); $I->amOnPage('/'); $I->see('Hello there', 'h1'); $I->see('Click here', 'a'); $I->click('Click here'); $I->amOnPage('/login'); $I->see('Log in here'); $I->fillField('name','Tudor'); $I->fillField('password','1234'); $I->click('Submit'); $I->see('Welcome');
$ php vendor/bin/doctrine orm:schema-tool:create --dump-sql > tests/_data/dump.sql
Test me like one of your French girls
$I->haveInDatabase( 'item', ['id' => 1, 'name' => 'first item’]);
$I->amOnPage('/items/');$I->see('first item');$I->see('Add new item');$I->click('Add new item');$I->fillField('name','second item');$I->click('Submit');
$I->seeInDatabase( 'item', ['id' => 2, 'name' => 'second item’]);
DB-CI
DB-STG
ci.my-project.tld
demo.my-project.tld
https://travis-ci.org - Open Sourcehttps://travis-ci.com - Commercial Projects
https://circleci.com/