Testing with Jenkins, Selenium and Continuous Deployment

17,919 views
17,602 views

Published on

My talk about testing at KharkivPy#4

Published in: Technology, Education

Testing with Jenkins, Selenium and Continuous Deployment

  1. 1. Testing with Jenkins, Selenium and Continuous Deployment Max Klymyshyn oDesk PS Twitter: @maxmaxmaxmax Github: joymax
  2. 2. The problemWe need to run our tests periodicallyTests execution take a lot of time, it’s not an option to run onintegrator’s machine all the timeWe want to run our Selenium tests on separated branchesWe don’t have persistent Selenium Grid nodesBlah blah, the CI problem...
  3. 3. The solutionJenkins as Continuous Integration toolSelenium Grid + Tests execution service with Amazon AWSinstances on-demandDeployment tool which can deploy any version of the codewithin isolated environment
  4. 4. TOCJenkins configurationSelenium Grid and Amazon AWS architectureDeployment tool with Fabric, Gunicorn, Nginx (+ Celery,Redis and Solr)Shortcuts for developersA bit about libraries development
  5. 5. StackFlaskMongoSolrRedisCelery
  6. 6. JenkinsCoverageTests results trend (junit reports)JSLintPylint
  7. 7. Tests executionunit, integration, consistency tests with NoseLettuce for forms and overall site UXJavaScript tests with Rhino and Flask-JasmineSelenium UI tests
  8. 8. Selenium Tests Execute tests Start selenium node(s) with requested browser(s) Execute selenium tests Shutdown node
  9. 9. Selenium Tests and Jenkins Headless tests (pass) Deploy current commit Execute selenium tests Destroy deployed commit
  10. 10. on-demand selenium nodesTests runner IE9 / Win IE8 / Win IE7 / WinService FF / Win Chrome / Win FF / LinuxSelenium Grid 2 Chrome / Linux
  11. 11. Selenium tests during devDeveloper execute tests with specific browserIt’s not necessary to have browserIt’s possible to debug tests with IPDBIt’s possible to see what’s going on on remove node usingSelenium Node admin or making screenshots
  12. 12. Tests runner configuration [runner]api_key=XXXXXXXXXnose_args=-vnose_single_test_args=-vcselenium_host=http://s.sample.com/wd/hubrpc_host=http://rpc.s.sample.com
  13. 13. Browsers configuration [internetexplorer-9]name=internetexplorerversion=9platform=WINDOWS[internetexplorer-7]name=internetexplorerversion=7platform=WINDOWS
  14. 14. Tests execution # Execute selenium tests in all browsersuitestrunner -c browsers.cfg -a# Execute synchronously in IE9 (+IPDB)uitestrunner -c browsers.cfg -s -binternetexplorer-9# Execute one test$ uitestrunner -c browsers.cfg -b internetexplorer-9 -t
  15. 15. Deployment tool FTWGet commit or branch Create virtualenvAdd Solr core install requirementsCreate mongo DB gunicorn by templateGenerate local_settings celery by templatestart services nginx by template
  16. 16. The flow for developersThe problem: QA engineer should check quality of each issue/branch Developer should provide “live” url to its branchSolution: Deploy specific branch Provide URL to it to QA engineer
  17. 17. Shortcuts for developersExecute shortcuts in working branch:doit deploydoit destroydoit restartdoit cleanup_build
  18. 18. SummaryEasy-to-demonstrate new changesEasy to QAAll team members informed about status
  19. 19. Questions?

×