Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Automatisation in development and testing - within budget

168 views

Published on

Working on client projects with very strict budget and resource restrictions, tight deadlines and pressure, many times does not allow for full blown Test Driven Development, Continuous Delivery and other software engineering goodness we would love to have. We will show you easily accessible and quickly implementable options, that allow you to automate your development and testing process, or at least the most painful parts, without blowing the budget. Finally you can relax during deployments of the code to production! :-)

Published in: Technology
  • Be the first to comment

Automatisation in development and testing - within budget

  1. 1. AutomatisationAutomatisation In Development and Quality Process (Within budget) David Lukac Senior Technical Consultant @ Inviqa Ltd. UK @davidlukac https://legacy.joind.in/18271 1
  2. 2. 2 . 1
  3. 3. 2 . 2
  4. 4. 2 . 3
  5. 5. https://inviqa.com 3 . 1
  6. 6. 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
  7. 7. 3 . 3
  8. 8. QuestionsQuestions 1. F 2. G/V 3. DR/DC 4. AQA 5. C* 4 . 1
  9. 9. 4 . 2
  10. 10. Why automate?Why automate? Saves time Streamline the process Efficiency Quality / Error rate 5 . 1
  11. 11. 5 . 2
  12. 12. Why CI/CD?Why CI/CD? 6 . 1
  13. 13. Why CI/CD?Why CI/CD? What? Merging Immediate testing & reporting G: Feedback ... ... Defects identified and corrected ASAP 6 . 2
  14. 14. Why CI/CD?Why CI/CD? What? Short cycles Releasebility G: Build, test, release ... ... fast, frequently 6 . 3
  15. 15. Why CI/CD?Why CI/CD? Business critical functionality Regression DRY Ease of mind Confidence Trust 6 . 4
  16. 16. 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
  17. 17. Preparation:Preparation: Unified environmentUnified environment Drush aliases 7 . 2
  18. 18. Preparation:Preparation: Unified environmentUnified environment Drush 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
  19. 19. Preparation:Preparation: Unified environmentUnified environment Drush aliases Stack DevDesktop 7 . 4
  20. 20. Preparation:Preparation: Unified environmentUnified environment Drush aliases Stack DevDesktop Drupal-VM 7 . 5
  21. 21. Preparation:Preparation: Unified environmentUnified environment Drush aliases Stack DevDesktop Drupal-VM Docker (Drude) 7 . 6
  22. 22. Credit: http://joefleming.net/posts/git-flow/ 7 . 7
  23. 23. Local tasksLocal tasks ShellShell >_>_ 8 . 1
  24. 24. Shell scriptsShell scripts #!/usr/bin/env bash # Basic deployment tasks. drush @mysite.${1} cc all drush @mysite.${1} updatedb -y drush @mysite.${1} cron 8 . 2
  25. 25. Shell scriptsShell 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 8 . 3
  26. 26. Shell scriptsShell 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 8 . 4
  27. 27. Shell scriptsShell 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 # Pull everything drush rsync ${source}:%files/ ${target}:%files/ --mode=ahkvz --progress -y drush sql-sync ${source} ${target} -y 8 . 5
  28. 28. Shell scriptsShell 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 # Pull everything drush rsync ${source}:%files/ ${target}:%files/ --mode=ahkvz --progress -y drush sql-sync ${source} ${target} -y # Tests cd behat bin/behat features/ 8 . 6
  29. 29. Shell scriptsShell scripts #!/usr/bin/env bash # Migration drush @mysite.${1} en menu_migrate -y drush @mysite.${1} mi Menu --feedback="100 items" 8 . 7
  30. 30. Shell scriptsShell scripts #!/usr/bin/env bash # Migration drush @mysite.${1} en menu_migrate -y drush @mysite.${1} mi Menu --feedback="100 items" # Solr drush @mysite.${1} solr-delete-index drush @mysite.${1} solr-index 8 . 8
  31. 31. Shell scriptsShell scripts #!/usr/bin/env bash # Deployment script drush @mysite.$1 fr feature_article -y drush @mysite.$1 vset my_custom_var 1 8 . 9
  32. 32. Shell scriptsShell 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-js drush @mysite.$1 cron 8 . 10
  33. 33. OtherOther Env. setup Dep. management npm, bundle Toggle Changelog Build 8 . 11
  34. 34. Local tasksLocal tasks GulpGulp 9 . 1
  35. 35. Gulp tasksGulp tasks watch compile copy serve 9 . 2
  36. 36. 10
  37. 37. Laravel EnvoyLaravel Envoy Server side, ssh Shell 11 . 1
  38. 38. Laravel EnvoyLaravel Envoy Server side, ssh Shell Easy to setup Works with WebSupport $ composer global require "laravel/envoy=~1.0" $ envoy init user@192.168.1.1 11 . 2
  39. 39. Laravel EnvoyLaravel Envoy Server side, ssh Shell Variables Servers Tasks Macros Setup 11 . 3
  40. 40. EnvoyEnvoy Envoy.blade.php --------------- @servers(['s1' => 'usr1@myserver.com -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
  41. 41. EnvoyEnvoy Envoy.blade.php --------------- @servers(['s1' => 'usr1@myserver.com -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
  42. 42. CapistranoCapistrano 12 . 1
  43. 43. CapistranoCapistrano Remote server Ruby Role, tasks, stages ... 12 . 2
  44. 44. ToolsTools Credit: http://galilsoftware.com/our-2015-ci-survey-the-results/ 13 . 1
  45. 45. ToolsTools Credit: http://galilsoftware.com/our-2015-ci-survey-the-results/ github.com/ripienaar/free-for-devgithub.com/ripienaar/free-for-dev 13 . 2
  46. 46. QA AutomationQA Automation 14 . 1
  47. 47. 14 . 2
  48. 48. QA AutomationQA Automation TTD Unit Tests ... 14 . 3
  49. 49. QA AutomationQA Automation TTD Unit Tests ... pricy? time consuming? ROI? 14 . 4
  50. 50. 14 . 5
  51. 51. 15 . 1
  52. 52. BehatBehat Behavioural testing Gather & test requirements User stories Gherkin 15 . 2
  53. 53. BehatBehat Behavioural testing Gather & test requirements User stories Gherkin Critical functionality Login Purchase Post ... 15 . 3
  54. 54. BehatBehat Behavioural testing Gather & test requirements User stories Gherkin Drupal support 15 . 4
  55. 55. BehatBehat default: suites: default: contexts: - FeatureContext - DrupalDrupalExtensionContextDrupalContext - DrupalDrupalExtensionContextMessageContext extensions: BehatMinkExtension: selenium2: ~ base_url: http://mysite.local DrupalDrupalExtension: 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
  56. 56. BehatBehat DrupalContext custom 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
  57. 57. 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
  58. 58. 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
  59. 59. BehatBehat Credit: http://erikaybar.name/building-and-testing-a-restful-api-using-behat-phpunit-and-laravel-part-1/ 15 . 9
  60. 60. Ghost InspectorGhost Inspector 16 . 1
  61. 61. Ghost InspectorGhost Inspector Automated UI testing Automated UI monitoring 16 . 2
  62. 62. Ghost InspectorGhost Inspector Automated UI testing Automated monitoring Screenshots Comparison 16 . 3
  63. 63. Ghost InspectorGhost Inspector 16 . 4
  64. 64. Ghost InspectorGhost Inspector Credit: http://www.hung-truong.com/blog/ 16 . 5
  65. 65. Ghost InspectorGhost Inspector Automated UI testing Automated monitoring Screenshots Comparison Step-by-step Selectors Recorder API 16 . 6
  66. 66. Ghost InspectorGhost Inspector Credit: http://www.hung-truong.com/blog/ 16 . 7
  67. 67. Ghost InspectorGhost Inspector API $ curl https://api.ghostinspector.com/v1/ suites/jabsdf7283947298374sdf/execute/ ?apiKey=aodjshfas72834970128347ijshdfg 16 . 8
  68. 68. Ghost InspectorGhost Inspector 16 . 9
  69. 69. Effectiveness + Quality Confidence + Trust Unified environment Automated Tasks Automated QA Time for coffee + $$$ RecapRecap 17
  70. 70. Q & DQ & D https://legacy.joind.in/18271 @davidlukac 18

×