3. Bom e velho cucumber
Accessing website with true credentials
When I am on the login page
And I fill in "email" with "bla@email.com"
And I fill in "password" with "qwerty"
And I click button "Login"
Then I should see "Olá, bla@email.com"
smell gerado pelo web_steps.rb
5. +1 Camada de abstração
Mais código para manter
Clientes
Duplicando código em linguagem natural
esperam LER a
especificação
Clientes não
querem escrever testes!
6. Alcançando Valor com
Cucumber
Acessing website with true
credentials:
When I am on the login page
And I use my credentials
Then I should see a welcome
message
7. Manutenção continuou um
saco!
Duplicando
rspecs & cucumber
steps
Refactoring não é
perfeito
Cada vez menos testes
de aceitação com
cucumber
source
8. Mantendo “Valor”
User accessing website
In order to easy accessing process, As a user
I can use my facebook account to connect
When a visitant doesn't have a website account
Accessing the registration process with facebook
Should automatically fill in his personal data
Should not present the password information
10. specs/acceptance/
facebook_integration.rb
describe "User acessing website", """
In order to easy accessing process
As a user
I can use a facebook account to connect with website""" do
context "When a user doesn't have a go2doc account" do
context "Acessing registration process with facebook" do
before do
end
it "Should automatically fill in personal data" do
(CODIGO RSPEC)
end
it "Should not present password information" do
(CODIGO RSPEC)
end
end
end https://gist.github.com/2992243
end
11. Given(:stack) { stack_with(initial_contents) }
context "when empty" do
Given(:initial_contents) { [] }
Then { stack.depth.should == 0 }
context "when pushing" do
When { stack.push(:an_item) }
Then { stack.depth.should == 1 }
Then { stack.top.should == :an_item }
end
end
https://github.com/jimweirich/rspec-given
12. feature "Articles", %q{
In order to have an awesome blog
As an author
I want to create and manage articles
} do
background do
Article.create!(:title => 'One')
end
scenario "Article index" do
visit '/articles'
page.should have_content('One')
end
end
https://github.com/cavalle/steak