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.

Testing nightwatch, by David Torroija

792 views

Published on

An intro to nightwatch(a tool to create and run functional tests, e2e tests using selenium in the background) and examples of cases, also how to integrate nightwatch to a Continous Integration tool

Published in: Engineering
  • Be the first to comment

Testing nightwatch, by David Torroija

  1. 1. Testing NightWatch JS An intro to Automation tests. by David Torroija
  2. 2. Que carajo veremos hoy? Index.html ➔ What? ➔ Why Automation? ➔ Why nightwatch? ➔ Examples ➔ CI ➔ Etc etc. Nightwatch logo
  3. 3. Que es esto? (What is this?) E2e testing, o testing funcional o automated Testing o llamále como quieras, es un testing que hacés graficamente un robot imitando a un usuario E2e testing or functional testing or whatever you like to call this, is a testing that simulates a person testing the app
  4. 4. ¿¿Porqué hacer test funcional?? Why functional test?
  5. 5. Siempre caerás a un proyecto que no tiene tests. Entonces esta será tu herramienta de batalla para asegurarte que está andando todo y te hará ser el héroe en ese caos. You will always go to a project that is not properly tested, so this tool is going to help you to be the hero in that caos ¿¿Porqué hacer test funcional?? Why functional test?
  6. 6. ¿Why NightwachJS? - JS == simple - Extensible - Uses selenium in the background - Uses nodejs - Easy integration with CI
  7. 7. How this works?
  8. 8. Example
  9. 9. Examples
  10. 10. Ejemplo -Se pueden agregar tags y desp correr solo tags específicos mediante . /nightwatch --tag ‘google’ -O bien saltearse los tests con determinado tag: ./nightwatch --skiptags ‘google’ This chaining expects are using chai library http://chaijs.com/api/bdd/
  11. 11. Ejemplo This example is using mocha as test runner
  12. 12. This example is using mocha as test runner
  13. 13. Config nightwach
  14. 14. Config nightwach
  15. 15. Nightwatch in action Only execute this test
  16. 16. Config nightwach
  17. 17. Config nightwach
  18. 18. . /node_modules/nightwatch/bin/nightwatch -e chrome,firefox,ie,safari,etc
  19. 19. custom-commands/waifForElementAndClick.js
  20. 20. Executing code in the browser using the “.execute()” method
  21. 21. Continous integration
  22. 22. Continous integration This example is with the a CI tool call wercker(is in the cloud) similar tools are: Thoughworks GO, Travis CI, Jenkins, etc
  23. 23. Continous integration
  24. 24. Continuous integration Wercker config.
  25. 25. Next Steps: ➔ Add more tests to widgets ➔ Migrate Mocha tests in Poe to Nightwatch native test runner to have more feedback about assertions ➔ Every member of the team must write a quick test of a familiar widget ➔ Run accessibility tests and html validation tests
  26. 26. Preguntas/Questions? More info in: ● nightwatchjs.org/ ● groups.google.com/forum/#!forum/nightwatchjs ● www.stackoverflow.com
  27. 27. Gracias! / Thanks mail : davidtorroija@gmail.com example Repo: github.com/davidtorroija/nightwatch-example

×