automatisation in development and testing - within budget

70
Automatisation Automatisation In Development and Quality Process (Within budget) David Lukac Senior Technical Consultant @ Inviqa Ltd. UK @davidlukac https://legacy.joind.in/18271 1

Upload: david-lukac

Post on 12-Apr-2017

162 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Automatisation in development and testing - within budget

AutomatisationAutomatisationIn Development and Quality Process

(Within budget)

David LukacSenior Technical Consultant@ Inviqa Ltd. UK

@davidlukachttps://legacy.joind.in/18271

1

Page 2: Automatisation in development and testing - within budget

2 . 1

Page 3: Automatisation in development and testing - within budget

2 . 2

Page 4: Automatisation in development and testing - within budget

2 . 3

Page 5: Automatisation in development and testing - within budget

https://inviqa.com

3 . 1

Page 6: Automatisation in development and testing - within budget

Software Engineer @ SiemensSoftware Engineer @ Siemens

Java Consultant @ T-Mobile AustriaJava Consultant @ T-Mobile Austria

CTO @ Mogdesign.euCTO @ Mogdesign.eu

Head of Project Operations @ iKOS Ltd.Head of Project Operations @ iKOS Ltd.

Senior Technical Consultant @ InviqaSenior Technical Consultant @ Inviqa

3 . 2

Page 7: Automatisation in development and testing - within budget

3 . 3

Page 8: Automatisation in development and testing - within budget

QuestionsQuestions1. F2. G/V3. DR/DC4. AQA5. C*

4 . 1

Page 9: Automatisation in development and testing - within budget

4 . 2

Page 10: Automatisation in development and testing - within budget

Why automate?Why automate?Saves timeStreamline the processEfficiencyQuality / Error rate

5 . 1

Page 11: Automatisation in development and testing - within budget

5 . 2

Page 12: Automatisation in development and testing - within budget

Why CI/CD?Why CI/CD?

6 . 1

Page 13: Automatisation in development and testing - within budget

Why CI/CD?Why CI/CD?What?

MergingImmediate testing & reportingG: Feedback ...... Defects identified and corrected ASAP

6 . 2

Page 14: Automatisation in development and testing - within budget

Why CI/CD?Why CI/CD?What?

Short cyclesReleasebilityG: Build, test, release ...... fast, frequently

6 . 3

Page 15: Automatisation in development and testing - within budget

Why CI/CD?Why CI/CD?Business critical functionalityRegressionDRYEase of mindConfidenceTrust

6 . 4

Page 16: Automatisation in development and testing - within budget

But how!? ... budget?!But how!? ... budget?!

Credit: http://www.dailymail.co.uk/news/article-2103067/Duck-cover--Astonishing-video-shows-U-S-ground-grunt-guinea-pigs-taking-atomic-

bomb-tests-1950s--trenches-protect-radiation.html

7 . 1

Page 17: Automatisation in development and testing - within budget

Preparation:Preparation:

Unified environmentUnified environmentDrush aliases

7 . 2

Page 18: Automatisation in development and testing - within budget

Preparation:Preparation:

Unified environmentUnified environmentDrush aliases

$ <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

7 . 3

Page 19: Automatisation in development and testing - within budget

Preparation:Preparation:

Unified environmentUnified environmentDrush aliasesStack

DevDesktop

7 . 4

Page 20: Automatisation in development and testing - within budget

Preparation:Preparation:

Unified environmentUnified environmentDrush aliasesStack

DevDesktopDrupal-VM

7 . 5

Page 21: Automatisation in development and testing - within budget

Preparation:Preparation:

Unified environmentUnified environmentDrush aliasesStack

DevDesktopDrupal-VMDocker (Drude)

7 . 6

Page 22: Automatisation in development and testing - within budget

Credit: http://joefleming.net/posts/git-flow/

7 . 7

Page 23: Automatisation in development and testing - within budget

Local tasksLocal tasksShellShell

>_>_

8 . 1

Page 24: Automatisation in development and testing - within budget

Shell scriptsShell scripts#!/usr/bin/env bash

# Basic deployment tasks.drush @mysite.${1} cc alldrush @mysite.${1} updatedb -ydrush @mysite.${1} cron

8 . 2

Page 25: Automatisation in development and testing - within budget

Shell scriptsShell scripts#!/usr/bin/env bash

# Basic deployment tasks.drush @mysite.${1} cc alldrush @mysite.${1} updatedb -ydrush @mysite.${1} cron

# Purge Varnishcurl -X PURGE -H "X-Acquia-Purge:[mysite.com]" -H "Accept-Encoding: gzip" https://mysite.com/about

8 . 3

Page 26: Automatisation in development and testing - within budget

Shell scriptsShell scripts#!/usr/bin/env bash

# Basic deployment tasks.drush @mysite.${1} cc alldrush @mysite.${1} updatedb -ydrush @mysite.${1} cron

# Purge Varnishcurl -X PURGE -H "X-Acquia-Purge:[mysite.com]" -H "Accept-Encoding: gzip" https://mysite.com/about

# Features# Hidden bonus(?!)drush @mysite.${1} fra -y

8 . 4

Page 27: Automatisation in development and testing - within budget

Shell scriptsShell scripts#!/usr/bin/env bash

# Basic deployment tasks.drush @mysite.${1} cc alldrush @mysite.${1} updatedb -ydrush @mysite.${1} cron

# Purge Varnishcurl -X PURGE -H "X-Acquia-Purge:[mysite.com]" -H "Accept-Encoding: gzip" https://mysite.com/about

# Features# Hidden bonus(?!)drush @mysite.${1} fra -y

# Pull everythingdrush rsync ${source}:%files/ ${target}:%files/ --mode=ahkvz --progress -ydrush sql-sync ${source} ${target} -y

8 . 5

Page 28: Automatisation in development and testing - within budget

Shell scriptsShell scripts#!/usr/bin/env bash

# Basic deployment tasks.drush @mysite.${1} cc alldrush @mysite.${1} updatedb -ydrush @mysite.${1} cron

# Purge Varnishcurl -X PURGE -H "X-Acquia-Purge:[mysite.com]" -H "Accept-Encoding: gzip" https://mysite.com/about

# Features# Hidden bonus(?!)drush @mysite.${1} fra -y

# Pull everythingdrush rsync ${source}:%files/ ${target}:%files/ --mode=ahkvz --progress -ydrush sql-sync ${source} ${target} -y

# Testscd behatbin/behat features/

8 . 6

Page 29: Automatisation in development and testing - within budget

Shell scriptsShell scripts#!/usr/bin/env bash

# Migrationdrush @mysite.${1} en menu_migrate -ydrush @mysite.${1} mi Menu --feedback="100 items"

8 . 7

Page 30: Automatisation in development and testing - within budget

Shell scriptsShell scripts#!/usr/bin/env bash

# Migrationdrush @mysite.${1} en menu_migrate -ydrush @mysite.${1} mi Menu --feedback="100 items"

# Solrdrush @mysite.${1} solr-delete-indexdrush @mysite.${1} solr-index

8 . 8

Page 31: Automatisation in development and testing - within budget

Shell scriptsShell scripts#!/usr/bin/env bash

# Deployment script

drush @mysite.$1 fr feature_article -ydrush @mysite.$1 vset my_custom_var 1

8 . 9

Page 32: Automatisation in development and testing - within budget

Shell scriptsShell scripts#!/usr/bin/env bash

# Deployment script

drush @mysite.$1 fr feature_article -ydrush @mysite.$1 vset my_custom_var 1

drush @mysite.$1 cc css-jsdrush @mysite.$1 cron

8 . 10

Page 33: Automatisation in development and testing - within budget

OtherOtherEnv. setupDep. managementnpm, bundleToggleChangelogBuild

8 . 11

Page 34: Automatisation in development and testing - within budget

Local tasksLocal tasksGulpGulp

9 . 1

Page 35: Automatisation in development and testing - within budget

Gulp tasksGulp taskswatchcompilecopyserve

9 . 2

Page 36: Automatisation in development and testing - within budget

10

Page 37: Automatisation in development and testing - within budget

Laravel EnvoyLaravel EnvoyServer side, sshShell

11 . 1

Page 38: Automatisation in development and testing - within budget

Laravel EnvoyLaravel EnvoyServer side, sshShell

Easy to setupWorks with WebSupport

$ composer global require "laravel/envoy=~1.0"

$ envoy init [email protected]

11 . 2

Page 39: Automatisation in development and testing - within budget

Laravel EnvoyLaravel EnvoyServer side, sshShellVariablesServersTasksMacrosSetup

11 . 3

Page 40: Automatisation in development and testing - within budget

EnvoyEnvoyEnvoy.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 }}

drush @mysite.prod sql-dump --result-file --gzip

git checkout master git pull

drush @mysite.prod updb drush @mysite.prod cc all drush @mysite.prod cron@endtask

@macro('deploy') deploy-prod clean-up@endmacro

11 . 4

Page 41: Automatisation in development and testing - within budget

EnvoyEnvoyEnvoy.blade.php---------------

@servers(['s1' => '[email protected] -p 12345'])

@task('deploy-prod', ['on' => 's1']) cd /var/www

drush @mysite.prod sql-dump --result-file --gzip

git checkout master git pull

drush @mysite.prod updb drush @mysite.prod cc all drush @mysite.prod cron@endtask

...

$ envoy run deploy-prod

11 . 5

Page 42: Automatisation in development and testing - within budget

CapistranoCapistrano

12 . 1

Page 43: Automatisation in development and testing - within budget

CapistranoCapistranoRemote serverRubyRole, tasks, stages ...

12 . 2

Page 44: Automatisation in development and testing - within budget

ToolsTools

Credit: http://galilsoftware.com/our-2015-ci-survey-the-results/

13 . 1

Page 45: Automatisation in development and testing - within budget

ToolsTools

Credit: http://galilsoftware.com/our-2015-ci-survey-the-results/

github.com/ripienaar/free-for-devgithub.com/ripienaar/free-for-dev

13 . 2

Page 46: Automatisation in development and testing - within budget

QA AutomationQA Automation

14 . 1

Page 47: Automatisation in development and testing - within budget

14 . 2

Page 48: Automatisation in development and testing - within budget

QA AutomationQA AutomationTTDUnit Tests...

14 . 3

Page 49: Automatisation in development and testing - within budget

QA AutomationQA AutomationTTDUnit Tests...pricy?time consuming?ROI?

14 . 4

Page 50: Automatisation in development and testing - within budget

14 . 5

Page 51: Automatisation in development and testing - within budget

15 . 1

Page 52: Automatisation in development and testing - within budget

BehatBehatBehavioural testingGather & test requirementsUser storiesGherkin

15 . 2

Page 53: Automatisation in development and testing - within budget

BehatBehatBehavioural testingGather & test requirementsUser storiesGherkinCritical functionality

LoginPurchasePost...

15 . 3

Page 54: Automatisation in development and testing - within budget

BehatBehatBehavioural testingGather & test requirementsUser storiesGherkinDrupal support

15 . 4

Page 55: Automatisation in development and testing - within budget

BehatBehatdefault: suites: default: contexts: - FeatureContext - Drupal\DrupalExtension\Context\DrupalContext - Drupal\DrupalExtension\Context\MessageContext extensions: Behat\MinkExtension: selenium2: ~ base_url: http://mysite.local Drupal\DrupalExtension: blackbox: ~ api_driver: 'drupal' drupal: drupal_root: '/var/www' text: log_out: "Log out" log_in: "Log in" password_field: "Password" username_field: "Username" selectors: message_selector: '.messages' error_message_selector: '.messages.error' success_message_selector: '.messages.status' warning_message_selector: '.messages.warning' region_map: header_search: ".search-toggle"

15 . 5

Page 56: Automatisation in development and testing - within budget

BehatBehatDrupalContextcustom context

<?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'); }

...

15 . 6

Page 57: Automatisation in development and testing - within budget

BehatBehat

Feature: Homepage I want to see a home page As 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

15 . 7

Page 58: Automatisation in development and testing - within budget

BehatBehat

Scenario: User can add the content administration Given I am logged in as a user with the "Content Editor" role When I go to "node/add/article" Then I should not see "Page not found" When I fill in "title" with "Behat testing article" And I fill in "media[field_listing_image_und_0]" with "314631" And I press the 'edit-submit' button Then I should see the following success messages: | success messages | | Article Behat testing article has been created. | And I should be able to register my article with title "Behat testing article" for cleanup

15 . 8

Page 59: Automatisation in development and testing - within budget

BehatBehat

Credit: http://erikaybar.name/building-and-testing-a-restful-api-using-behat-phpunit-and-laravel-part-1/

15 . 9

Page 60: Automatisation in development and testing - within budget

Ghost InspectorGhost Inspector

16 . 1

Page 61: Automatisation in development and testing - within budget

Ghost InspectorGhost InspectorAutomated UI testingAutomated UI monitoring

16 . 2

Page 62: Automatisation in development and testing - within budget

Ghost InspectorGhost InspectorAutomated UI testingAutomated monitoringScreenshotsComparison

16 . 3

Page 63: Automatisation in development and testing - within budget

Ghost InspectorGhost Inspector

16 . 4

Page 64: Automatisation in development and testing - within budget

Ghost InspectorGhost Inspector

Credit: http://www.hung-truong.com/blog/

16 . 5

Page 65: Automatisation in development and testing - within budget

Ghost InspectorGhost InspectorAutomated UI testingAutomated monitoringScreenshotsComparisonStep-by-stepSelectorsRecorderAPI

16 . 6

Page 66: Automatisation in development and testing - within budget

Ghost InspectorGhost Inspector

Credit: http://www.hung-truong.com/blog/

16 . 7

Page 67: Automatisation in development and testing - within budget

Ghost InspectorGhost InspectorAPI

$ curl https://api.ghostinspector.com/v1/ suites/jabsdf7283947298374sdf/execute/ ?apiKey=aodjshfas72834970128347ijshdfg

16 . 8

Page 68: Automatisation in development and testing - within budget

Ghost InspectorGhost Inspector

16 . 9

Page 69: Automatisation in development and testing - within budget

Effectiveness + QualityConfidence + TrustUnified environmentAutomated TasksAutomated QATime for coffee + $$$

RecapRecap

17

Page 70: Automatisation in development and testing - within budget

Q & DQ & D

https://legacy.joind.in/18271 @davidlukac18