30
Тестирование web-приложений на базе технологий Ruby / Cucumber / Watir WebDriver

Тестирование web-приложений на базе технологий Ruby/Cucumber/Watir Webdriver

Embed Size (px)

Citation preview

Тестирование web-приложений на базе технологий Ruby / Cucumber / Watir WebDriver

TDD BDD

Test-driven development: pазработка через тестирование

Behavior-driven development: pазработка через поведение

Виды тестирования (по охвату тестируемого приложения)

модульное интеграционное

системное приемочное

Cucumber гибкий BDD-фреймворк для написания acceptance-тестов

scenario 1

scenario 3

scenario 2

scenario 4

background

Feature:

step definitions

Feature + scenarios + steps

Background

Step definitions

env.rb

hooks.rb

World

Запуск тестов

• стандартный запуск:

• через rake:

Cucumber HTML formatter

Selenium WebDriver – это программная библиотека для управления браузерами.

Watir WebDriver – ruby-фреймворк для автоматизации тестов веб-приложений, который базируется на библиотеке Selenium WebDriver.

Инициализация драйвера

Web Elements методы доступа и манипулирования web-елементами страницы

Text fields and select lists

Radiobuttons and checkboxes

Buttons and links

Divs and spans

WYSIWYG Editors (What You See Is What You Get)

Ожидание элементов (AJAX ожидания)

Явные ожидания (explicit waits)• Watir::Wait.until { ... }: where you can wait for a block to be true • object.when_present.set: where you can do something when it’s present • object.wait_until_present: where you just wait until something is present • object.wait_while_present: where you just wait until something disappears

Неявные ожидания (implicit waits)

Page Objects шаблон проектирования тестового приложения для поиска конкретных элементов страницы

Watirsome

RSpec гибкий BDD-фреймворк для написания unit-тестов

RSpec Expectations (part 1)

RSpec Expectations (part 2)

RSpec Expectations (part 3)

RSpec Expectations (part 4)

References

• Все о cucumber: https://cucumber.io/ • Cucumber wiki: https://github.com/cucumber/cucumber/wiki/A-Table-Of-Content • Все о Selenium WebDriver (ru): http://selenium2.ru/ • Все о Watir WebDriver: http://watirwebdriver.com/ • Концепция PageObject: http://martinfowler.com/bliki/PageObject.html • Watirsome на github: https://github.com/p0deje/watirsome • Rspec core: http://rspec.info/documentation/3.3/rspec-core • Rspec expectations: http://rspec.info/documentation/3.3/rspec-expectations/ • Rspec guidelines: http://betterspecs.org/ • Ruby и тестирование: https://github.com/atinfo/awesome-test-automation/blob/

master/ruby-test-automation.md