SlideShare uma empresa Scribd logo
1 de 53
BDD para projetos
.NET
Por que?
Facilidade
Facilidade
Praticidade
Facilidade
Praticidade
Lingua nativa
Facilidade
Praticidade
Lingua nativa (ou quase isso)
Testes end-to-end
Testes end-to-end
Como assim?
Testes end-to-end
Interface Controller Repositorio
BD
Testes end-to-end
Interface Controller Repositorio
BD
User (browser)
Testes end-to-end
Interface Controller Repositorio
BD
User (browser)
Testa todas as camadas
Ferramentas
Ferramentas?
Ferramentas
Selenium
Ferramentas
Selenium (browser)
Ferramentas
Selenium (browser)
SpecFlow
Ferramentas
Selenium (browser)
SpecFlow (solução BDD)
Ferramentas
Selenium (browser)
SpecFlow (solução BDD)
NUnit
Ferramentas
Selenium (browser)
SpecFlow (solução BDD)
NUnit (framework de testes - asserções)
Sintaxe
Sintaxe
Feature file:
Sintaxe
Feature file:
Feature: Login
In order to access my account
As a user of the website
I want to log into the website
Scenario: Logging in with valid credentials
Given I am at the login page
When I fill in the following form
| field | value |
| Username | xtrumanx |
| Password | P@55w0Rd |
And I click the login button
Then I should be at the home page
Sintaxe
Feature file:
Feature: Login
In order to access my account
As a user of the website
I want to log into the website
Scenario: Logging in with valid credentials
Given I am at the login page
When I fill in the following form
| field | value |
| Username | xtrumanx |
| Password | P@55w0Rd |
And I click the login button
Then I should be at the home page
Feature definition:
Sintaxe
Feature file:
Feature: Login
In order to access my account
As a user of the website
I want to log into the website
Scenario: Logging in with valid credentials
Given I am at the login page
When I fill in the following form
| field | value |
| Username | xtrumanx |
| Password | P@55w0Rd |
And I click the login button
Then I should be at the home page
[Binding]
class LoginStepDefinitions
{
[Given("I am at the login page")]
public void GivenIAmAtTheLoginPage()
{
// TODO
}
}
Feature definition:
Sintaxe
Feature file:
Feature: Login
In order to access my account
As a user of the website
I want to log into the website
Scenario: Logging in with valid credentials
Given I am at the login page
When I fill in the following form
| field | value |
| Username | xtrumanx |
| Password | P@55w0Rd |
And I click the login button
Then I should be at the home page
[Binding]
class LoginStepDefinitions
{
[Given("I am at the login page")]
public void GivenIAmAtTheLoginPage()
{
// TODO
}
}
Feature definition:
Sintaxe
Feature file:
Feature: Login
In order to access my account
As a user of the website
I want to log into the website
Scenario: Logging in with valid credentials
Given I am at the login page
When I fill in the following form
| field | value |
| Username | xtrumanx |
| Password | P@55w0Rd |
And I click the login button
Then I should be at the home page
[Binding]
class LoginStepDefinitions
{
[Given("I am at the login page")]
public void GivenIAmAtTheLoginPage()
{
driver.Navigate.GoToUrl("www.gmail.com")
}
}
Feature definition:
Sintaxe
Sintaxe
Resultado:
Sintaxe
Resultado:
Sintaxe
Sintaxe
Vamos incrementar esse teste!
Sintaxe
Feature file:
Feature: Login
In order to access my account
As a user of the website
I want to log into the website
Scenario: Logging in with valid credentials
Given I am at the login page
When I fill in the following form
| field | value |
| Username | xtrumanx |
| Password | P@55w0Rd |
And I click the login button
Then I should be at the home page
[Binding]
class LoginStepDefinitions
{
[When("I fill in the following form")]
public void
WhenIFillInTheFollowingForm(TechTalk.SpecFlow.Table table)
{
foreach(var row in table.Rows)
{
var textField =
driver.FindElement(By.Id(row["field"]));
if(!textField.Exists)
Assert.Fail("Expected to find a text field with the
name of '{0}'.", row["field"]);
textField.TypeText(row["value"]);
}
}
}
Feature definition:
Sintaxe
Resultado:
Sintaxe
xtrumanx
P@55w0Rd
O que testar?
O que testar?
O que for importante
O que testar?
O que for importante
E porque não tudo?
Testes de aceitação tendem:
Testes de aceitação tendem:
1. Difícil escrita
Testes de aceitação tendem:
1. Difícil escrita
2. Difícil manutenção
Testes de aceitação tendem:
1. Difícil escrita
2. Difícil manutenção
3. Execução lenta
Testes de aceitação tendem:
1. Difícil escrita
2. Difícil manutenção
3. Execução lenta
Testes de aceitação tendem:
1. Difícil escrita
2. Difícil manutenção
3. Execução lenta
Testes de aceitação tendem:
1. Difícil escrita
2. Difícil manutenção
3. Execução lenta
Testes de aceitação tendem:
1. Difícil escrita
2. Difícil manutenção
3. Execução lenta
4. Feedback demorado
Testes de aceitação tendem:
1. Difícil escrita
2. Difícil manutenção
3. Execução lenta
4. Feedback demorado
Cenário ideal:
Cenário ideal:
*quase* ideal
Cenário ideal:
ideal
Por que?
Feedback rápido é importante
Por que?
Feedback rápido é importante
Por que?
Feedback rápido é importante
Por que?
Feedback rápido é importante
Sugestão
Sugestão
http://www.infoq.com/br/presentations/o-que-nao-testar

Mais conteúdo relacionado

Semelhante a BDD in .NET projects

Testes Automatizados e o iOS
Testes Automatizados e o iOSTestes Automatizados e o iOS
Testes Automatizados e o iOS
Ricardo Valeriano
 

Semelhante a BDD in .NET projects (20)

Qualidade de Software: Escrevendo Código Limpo
Qualidade de Software: Escrevendo Código LimpoQualidade de Software: Escrevendo Código Limpo
Qualidade de Software: Escrevendo Código Limpo
 
Seu Cliente no Controle! Testes ágeis
Seu Cliente no Controle! Testes ágeisSeu Cliente no Controle! Testes ágeis
Seu Cliente no Controle! Testes ágeis
 
Mini Curso PHP Twig - PHP Conference 2017
Mini Curso PHP Twig - PHP Conference 2017 Mini Curso PHP Twig - PHP Conference 2017
Mini Curso PHP Twig - PHP Conference 2017
 
Workshop Django
Workshop DjangoWorkshop Django
Workshop Django
 
JQuery Alagoinhas Dev Day - UNEB
JQuery Alagoinhas Dev Day - UNEBJQuery Alagoinhas Dev Day - UNEB
JQuery Alagoinhas Dev Day - UNEB
 
Desenvolvendo com Silverlight para WP7 Mango [Update]
Desenvolvendo com Silverlight para WP7 Mango [Update]Desenvolvendo com Silverlight para WP7 Mango [Update]
Desenvolvendo com Silverlight para WP7 Mango [Update]
 
Wicket 2008
Wicket 2008Wicket 2008
Wicket 2008
 
Criação de aplicações web com python
Criação de aplicações web com pythonCriação de aplicações web com python
Criação de aplicações web com python
 
Python 08
Python 08Python 08
Python 08
 
Play Framework - FLISOL
Play Framework - FLISOLPlay Framework - FLISOL
Play Framework - FLISOL
 
Intrudução ao Behavior Driven Development (BDD) com Ruby on Rails
Intrudução ao Behavior Driven Development (BDD) com Ruby on RailsIntrudução ao Behavior Driven Development (BDD) com Ruby on Rails
Intrudução ao Behavior Driven Development (BDD) com Ruby on Rails
 
Maratona Windows Phone 7
Maratona Windows Phone 7Maratona Windows Phone 7
Maratona Windows Phone 7
 
Testes Automatizados e o iOS
Testes Automatizados e o iOSTestes Automatizados e o iOS
Testes Automatizados e o iOS
 
Boas práticas de Automação de Testes
Boas práticas de Automação de TestesBoas práticas de Automação de Testes
Boas práticas de Automação de Testes
 
Programação Orientada a Testes
Programação Orientada a TestesProgramação Orientada a Testes
Programação Orientada a Testes
 
Explorando a API Rest Jira Cloud
Explorando a API Rest Jira CloudExplorando a API Rest Jira Cloud
Explorando a API Rest Jira Cloud
 
InterCon 2017 - Engenharia de segurança web: Proteja todas as camadas de seu ...
InterCon 2017 - Engenharia de segurança web: Proteja todas as camadas de seu ...InterCon 2017 - Engenharia de segurança web: Proteja todas as camadas de seu ...
InterCon 2017 - Engenharia de segurança web: Proteja todas as camadas de seu ...
 
Treze ferramentas/frameworks para desenvolvimento Android
Treze ferramentas/frameworks para desenvolvimento AndroidTreze ferramentas/frameworks para desenvolvimento Android
Treze ferramentas/frameworks para desenvolvimento Android
 
Treze ferramentas/frameworks para desenvolvimento android
Treze ferramentas/frameworks para desenvolvimento androidTreze ferramentas/frameworks para desenvolvimento android
Treze ferramentas/frameworks para desenvolvimento android
 
Aplicacoes Rapidas Para Web Com Django
Aplicacoes Rapidas Para Web Com DjangoAplicacoes Rapidas Para Web Com Django
Aplicacoes Rapidas Para Web Com Django
 

Último

Apresentação Power Embedded - Descubra uma nova forma de compartilhar relatór...
Apresentação Power Embedded - Descubra uma nova forma de compartilhar relatór...Apresentação Power Embedded - Descubra uma nova forma de compartilhar relatór...
Apresentação Power Embedded - Descubra uma nova forma de compartilhar relatór...
Dirceu Resende
 

Último (9)

Apresentação Power Embedded - Descubra uma nova forma de compartilhar relatór...
Apresentação Power Embedded - Descubra uma nova forma de compartilhar relatór...Apresentação Power Embedded - Descubra uma nova forma de compartilhar relatór...
Apresentação Power Embedded - Descubra uma nova forma de compartilhar relatór...
 
COI CENTRO DE OPERAÇÕES INDUSTRIAIS NAS USINAS
COI CENTRO DE OPERAÇÕES INDUSTRIAIS NAS USINASCOI CENTRO DE OPERAÇÕES INDUSTRIAIS NAS USINAS
COI CENTRO DE OPERAÇÕES INDUSTRIAIS NAS USINAS
 
From_SEH_Overwrite_with_Egg_Hunter_to_Get_a_Shell_PT-BR.pdf
From_SEH_Overwrite_with_Egg_Hunter_to_Get_a_Shell_PT-BR.pdfFrom_SEH_Overwrite_with_Egg_Hunter_to_Get_a_Shell_PT-BR.pdf
From_SEH_Overwrite_with_Egg_Hunter_to_Get_a_Shell_PT-BR.pdf
 
[ServiceNow] Upgrade de versão - 2ª edição (Revisada, atualizada e ampliada)
[ServiceNow] Upgrade de versão - 2ª edição (Revisada, atualizada e ampliada)[ServiceNow] Upgrade de versão - 2ª edição (Revisada, atualizada e ampliada)
[ServiceNow] Upgrade de versão - 2ª edição (Revisada, atualizada e ampliada)
 
Palestras sobre Cibersegurança em Eventos - Paulo Pagliusi
Palestras sobre Cibersegurança em Eventos - Paulo PagliusiPalestras sobre Cibersegurança em Eventos - Paulo Pagliusi
Palestras sobre Cibersegurança em Eventos - Paulo Pagliusi
 
Entrevistas, artigos, livros & citações de Paulo Pagliusi
Entrevistas, artigos, livros & citações de Paulo PagliusiEntrevistas, artigos, livros & citações de Paulo Pagliusi
Entrevistas, artigos, livros & citações de Paulo Pagliusi
 
EAD Curso - CIÊNCIA DE DADOS NA INDÚSTTRIA
EAD Curso - CIÊNCIA DE DADOS NA INDÚSTTRIAEAD Curso - CIÊNCIA DE DADOS NA INDÚSTTRIA
EAD Curso - CIÊNCIA DE DADOS NA INDÚSTTRIA
 
Apostila e caderno de exercicios de WORD
Apostila e caderno de exercicios de  WORDApostila e caderno de exercicios de  WORD
Apostila e caderno de exercicios de WORD
 
O futuro e o impacto da tecnologia nas salas de aulas
O futuro e o impacto da tecnologia  nas salas de aulasO futuro e o impacto da tecnologia  nas salas de aulas
O futuro e o impacto da tecnologia nas salas de aulas
 

BDD in .NET projects