Игры с огнём: знакомимся с BDD и Cucumber фреймворком BDDfire
1. Software quality assurance days
19 Международная конференция
по вопросам качества ПО
sqadays.com
Санкт-Петербург. 20–21 мая 2016
Владислав Романенко
Intellectsoft. Минск, Беларусь
Игры с огнём: знакомимся с BDD
и Cucumber фреймворком BDDfire
2. QA-инженер в Intellectsoft
В тестировании >2 лет,
до этого работал инженером
географических информационных
систем (ГИС)
Тестирую мобильные и веб
приложения
Сертификат ISTQB Foundation level
v.romanenko_
laechoppe@gmail.com
3. BDD is like Jazz.
There is no
authoritative
definition of what it is
4. BDD
is a process designed to aid
the management and the delivery
of software development projects
by improving communication
between engineers and business
professionals
29. Predefined steps:
Given I am on “url”
When I click on element having text “foo"
Then The page title is “bar"
30. Predefined steps definitions:
Then(/^page contains "(.*?)"$/) do |element|
page.should have_css(element)
end
Then(/^I should see "(.*?)"$/) do |text|
page.should have_content text
end
31. Scenario: Signing in as an existing user
Given I am on "http://test.org/auth"
When I fill in "email" with the text "vlad@r.by"
And I fill in "password" with the text "qwerty"
And I click on element having text "Sign In"
Then The page title is "Homepage"
Hello world scenario:
33. 1. Features
Project structure:
Scenario: I can see the quantity of risks in each state
Given I'm a rescue team member
When I observe the table of risks
Then I see the correct quantity of risks by state
34. Project structure:
When (/^I want to view the details of a Risk/) do
risk_num = rand(1...10).to_s
link = '#/steps/' + risk_num + '/details'
find(:xpath,"(//*[@href='#{link}'])[1]").click
end
2. Step definitions
35. Project structure:
Capybara.configure do |config|
config.run_server = false
...
config.default_selector = :xpath
config.default_wait_time = 60
end
3. Support code
43. What’s included?
1. Capybara
Given(/^I am on homepage$/) do
visit('http://risk.piemont.org/#/login')
end
Given(/^I want to see Risk timeline/) do
find(:xpath,'//*[@ui-sref="risk.timeline"]').click
end
45. What’s included?
2. Poltergeist
@poltergeist
Scenario: Signing in as an existing user
Given I am on "http://test.org/auth"
When I fill in "email" with the text "vlad@r.by"
And I fill in "password" with the text "qwerty"
And I click on element having text "Sign In"
Then The page title is "Homepage"
56. What’s included?
8. RestClient
Given I send a GET request for "<your_uri>"
Given I send a GET/PUT/POST/DELETE request
for "<your_uri>" with the following:
"""
<your_payload>
"""
Then the response should be JSON