Automatisation in development and testing - within budget [IronCamp prague 2016-11]
-
Upload
david-lukac -
Category
Technology
-
view
61 -
download
1
Transcript of Automatisation in development and testing - within budget [IronCamp prague 2016-11]
![Page 1: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/1.jpg)
AUTOMATIZATIONIN DEVELOPMENT AND QUALITY PROCESS
(WITHIN BUDGET)
David LukacSenior Technical ConsultantInviqa UK Ltd.@davidlukac
![Page 2: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/2.jpg)
![Page 3: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/3.jpg)
![Page 4: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/4.jpg)
![Page 5: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/5.jpg)
David LukacSenior Technical ConsultantInviqa UK Ltd.@davidlukac
![Page 6: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/6.jpg)
http://inviqa.com
![Page 7: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/7.jpg)
BACKGROUND
• Software Engineer @ Siemens• Java Consultant @ T-‐Mobile Austria
• CTO @ Mogdesign.eu• Head of Project Operations @ I-‐KOS Ltd.• Senior Technical Consultant @ Inviqa UK
![Page 8: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/8.jpg)
Questions1. F
2. G/V3. DR/DC4. AQA5. C*
![Page 9: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/9.jpg)
WHY AUTOMATE?
• Saves time• Streamline process
• Efficiency• Quality / Error rate
![Page 10: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/10.jpg)
![Page 11: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/11.jpg)
WHAT IS CI?
• Best practice …• Merging …
• Immediate testing and reporting …• G: Rapid feedback …
• O: Defects identified and corrected ASAP
![Page 12: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/12.jpg)
WHAT IS CD?
• Short cycles …• Releasibility …
• G: Build, test, release …• O: … fast, frequently.
![Page 13: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/13.jpg)
WHY CI/CD?
• Business Critical Functionality• Regression• DRY
• Ease of Mind• Confidence• Trust
![Page 14: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/14.jpg)
BUT HOW?! … WHAT ABOUT THE BUDGET!?
![Page 15: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/15.jpg)
PREPARATION – UNIFIED ENVIRONMENT
• Drush aliases• Local Stack• DevDesktop• DrupalVM / Virtualbox• Docker
![Page 16: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/16.jpg)
PREPARATION – UNIFIED ENVIRONMENT
$ <project root>/drush/mysite.aliases.drushrc.php
<?php$aliases['mysite.local'] = array( .... ); $aliases['mysite.stage'] = array( .... ); $aliases['mysite.uat'] = array( .... ); $aliases['mysite.prod'] = array( .... );
...
$ ln -‐s ${DIR}/mysite.aliases.drushrc.php ~/.drush/mysite.aliases.drushrc.php
![Page 17: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/17.jpg)
Credit: http://joefleming.net/posts/git-‐flow/
![Page 18: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/18.jpg)
LOCAL TASKSSHELL
>_
![Page 19: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/19.jpg)
SHELL SCRIPTS
#!/usr/bin/env bash
# Basic deployment tasks. drush @mysite.${1} cc all drush @mysite.${1} updatedb -‐y drush @mysite.${1} cron
![Page 20: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/20.jpg)
SHELL SCRIPTS
#!/usr/bin/env bash
# Basic deployment tasks. drush @mysite.${1} cc all drush @mysite.${1} updatedb -‐y drush @mysite.${1} cron
# Purge Varnish curl -‐X PURGE -‐H "X-‐Acquia-‐Purge:[mysite.com]”
-‐H "Accept-‐Encoding: gzip" https://mysite.com/about
![Page 21: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/21.jpg)
SHELL SCRIPTS
#!/usr/bin/env bash
# Basic deployment tasks. drush @mysite.${1} cc all drush @mysite.${1} updatedb -‐y drush @mysite.${1} cron
# Purge Varnish curl -‐X PURGE -‐H "X-‐Acquia-‐Purge:[mysite.com]”
-‐H "Accept-‐Encoding: gzip" https://mysite.com/about
# Features # Hidden bonus(?!) drush @mysite.${1} fra -‐y
![Page 22: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/22.jpg)
SHELL SCRIPTS
# Pull everything drush rsync ${source}:%files/ ${target}:%files/ -‐-‐mode=ahkvz -‐-‐progress -‐y drush sql-‐sync ${source} ${target} –y
![Page 23: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/23.jpg)
SHELL SCRIPTS
# Pull everything drush rsync ${source}:%files/ ${target}:%files/ -‐-‐mode=ahkvz -‐-‐progress -‐y drush sql-‐sync ${source} ${target} –y
# Tests bin/behat features/
![Page 24: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/24.jpg)
SHELL SCRIPTS
# Pull everything drush rsync ${source}:%files/ ${target}:%files/ -‐-‐mode=ahkvz -‐-‐progress -‐y drush sql-‐sync ${source} ${target} –y
# Tests bin/behat features/
# Migration drush @mysite.${1} en menu_migrate -‐y drush @mysite.${1} mi Menu -‐-‐feedback="100 items"
![Page 25: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/25.jpg)
SHELL SCRIPTS
# Pull everything drush rsync ${source}:%files/ ${target}:%files/ -‐-‐mode=ahkvz -‐-‐progress -‐y drush sql-‐sync ${source} ${target} –y
# Tests bin/behat features/
# Migration drush @mysite.${1} en menu_migrate -‐y drush @mysite.${1} mi Menu -‐-‐feedback="100 items”
# Solrdrush @mysite.${1} solr-‐delete-‐index drush @mysite.${1} solr-‐index
![Page 26: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/26.jpg)
DEPLOYMENT SHELL SCRIPTS
#!/usr/bin/env bash
# Deployment script drush @mysite.$1 fr feature_article -‐y drush @mysite.$1 vset my_custom_var 1
![Page 27: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/27.jpg)
DEPLOYMENT SHELL SCRIPTS
#!/usr/bin/env bash
# Deployment script drush @mysite.$1 fr feature_article -‐y drush @mysite.$1 vset my_custom_var 1
drush @mysite.$1 cc css-‐jsdrush @mysite.$1 cron
![Page 28: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/28.jpg)
OTHER
• Environment setup• Dependency management – npm, bundle, compose
• Assets – gulp• Changelog, release notes
• Toggle modules
![Page 29: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/29.jpg)
![Page 30: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/30.jpg)
REMOTE DEPLOYMENT
Laravel Envoy (PHP)
• Server side (too)
• SSH
• Easy to setup
• Servers• Tasks
• Macros
• Setup
![Page 31: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/31.jpg)
Envoy.blade.php-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐@servers(['s1' => '[email protected] -‐p 12345'])
@setup $now = new DateTime(); $environment = isset($env) ? $env : "testing";
@endsetup
@task('deploy-‐prod', ['on' => 's1']) cd /var/www; echo {{ $now }}; echo {{ $environment }} git checkout master; git pull drush @mysite.prod updbdrush @mysite.prod cc all drush @mysite.prod cron
@endtask
@macro('deploy') deploy-‐prod clean-‐up
@endmacro
![Page 32: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/32.jpg)
$ envoy run deploy-‐prod
![Page 33: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/33.jpg)
REMOTE DEPLOYMENT
Laravel Envoy (PHP)
• Server side (too)
• SSH
• Easy to setup
• Servers• Tasks
• Macros
• Setup
Fabric (Python)
• Server side (too)
• SSH
• Easy to setup• Inventory
• Tasks
• Parallel execution
• Strength of Python ecosystem
![Page 34: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/34.jpg)
Fabfile.py-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐from fabric.api import run, local, cd, env, taskimport ConfigParserimport os
env.hosts = [’devops@tergetserver’]
@task()def deploy():
local("git fetch")local("git checkout master")local("git pull")local("git push {r} HEAD".format(r=git_remote_name))prod_dir = ’/var/www/project’with cd(prod_dir):
run("git fetch")run("git checkout master")run("git pull")run("composer install -‐-‐no-‐dev -‐-‐no-‐progress -‐-‐no-‐suggest
-‐-‐optimize-‐autoloader -‐-‐no-‐interaction")
![Page 35: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/35.jpg)
REMOTE DEPLOYMENT
Others
• Laravel Envoy (PHP)
• Rocketeer (PHP)
• Fabric (Python)
• Invoke (Python)• Ansible (YAML, Python)
• Capistrano (Ruby)
![Page 36: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/36.jpg)
CI/CD CLOUD TOOLS
Credit: http://galilsoftware.com/our-‐2015-‐ci-‐survey-‐the-‐results/
![Page 37: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/37.jpg)
CI/CD CLOUD TOOLS
Credit: http://galilsoftware.com/our-‐2015-‐ci-‐survey-‐the-‐results/
GITHUB.COM/RIPIENAAR/FREE-‐FOR-‐DEV
![Page 38: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/38.jpg)
QA AUTOMATION
![Page 39: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/39.jpg)
http://inviqa.com
![Page 40: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/40.jpg)
QA AUTOMATION
• TDD• Unit Tests• …• Pricy?• Time consuming?• ROI?
![Page 41: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/41.jpg)
DDD & BDD
![Page 42: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/42.jpg)
BEHAT
• Behavioral testing• Gather and describe business requirements• Test business requirements• User stories• Gherkin
![Page 43: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/43.jpg)
BEHAT
• Behavioral testing• Gather and describe business requirements• Test business requirements• User stories• Gherkin
• Describe and test critical functionality:• Login• Purchase• Editorial• …• Drupal support
![Page 44: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/44.jpg)
Feature: Homepage I want to see a home pageAs a user So I can see the latest featured content on the site.
Background: Given I am not logged in When I visit "/"
Scenario: User can see Main header Then I should see the text "welcome to our site”And I should see the subheading
Scenario: User can see Latest Articles Then I should see 11 latest homepage articles
![Page 45: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/45.jpg)
<?php
class FeatureContext extends RawDrupalContext implements SnippetAcceptingContext{
...
/** * @Then I should see the subheading */
public function iShouldSeeSubHeading() { $this-‐>countElements('.taxonomy-‐term.vocabulary-‐sections
.field-‐name-‐field-‐body .field-‐item', 1, 'Homepage subheading'); }
...
![Page 46: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/46.jpg)
![Page 47: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/47.jpg)
![Page 48: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/48.jpg)
GHOST INSPECTOR
• Automated UI testing• Automated monitoring• Screenshots• Comparison• Browser actions, forms
![Page 49: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/49.jpg)
GHOST INSPECTOR
• Automated UI testing• Automated monitoring• Screenshots• Comparison• Browser actions, forms
• Step by Step• Selectors• Recorder• API
![Page 50: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/50.jpg)
![Page 51: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/51.jpg)
![Page 52: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/52.jpg)
![Page 53: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/53.jpg)
RECAP
• Effectiveness & Quality• Confidence & Trust• Unified environment• Automated tasks• Automated QA
• Time for coffee + $$$
![Page 54: Automatisation in development and testing - within budget [IronCamp prague 2016-11]](https://reader031.fdocuments.net/reader031/viewer/2022021813/58a852a11a28ab210b8b6121/html5/thumbnails/54.jpg)
THANK YOU!
QUESTIONS?