Your SlideShare is downloading. ×
BDD in .NET projects
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

BDD in .NET projects

121
views

Published on

Talk presented to Atlântico Team.

Talk presented to Atlântico Team.

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
121
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. BDD para projetos .NET
  • 2. Por que?
  • 3. Facilidade
  • 4. Facilidade Praticidade
  • 5. Facilidade Praticidade Lingua nativa
  • 6. Facilidade Praticidade Lingua nativa (ou quase isso)
  • 7. Testes end-to-end
  • 8. Testes end-to-end Como assim?
  • 9. Testes end-to-end Interface Controller Repositorio BD
  • 10. Testes end-to-end Interface Controller Repositorio BD User (browser)
  • 11. Testes end-to-end Interface Controller Repositorio BD User (browser) Testa todas as camadas
  • 12. Ferramentas
  • 13. Ferramentas?
  • 14. Ferramentas Selenium
  • 15. Ferramentas Selenium (browser)
  • 16. Ferramentas Selenium (browser) SpecFlow
  • 17. Ferramentas Selenium (browser) SpecFlow (solução BDD)
  • 18. Ferramentas Selenium (browser) SpecFlow (solução BDD) NUnit
  • 19. Ferramentas Selenium (browser) SpecFlow (solução BDD) NUnit (framework de testes - asserções)
  • 20. Sintaxe
  • 21. Sintaxe Feature file:
  • 22. 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
  • 23. 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:
  • 24. 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:
  • 25. 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:
  • 26. 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:
  • 27. Sintaxe
  • 28. Sintaxe Resultado:
  • 29. Sintaxe Resultado: Sintaxe
  • 30. Sintaxe Vamos incrementar esse teste!
  • 31. 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:
  • 32. Sintaxe Resultado: Sintaxe xtrumanx P@55w0Rd
  • 33. O que testar?
  • 34. O que testar? O que for importante
  • 35. O que testar? O que for importante E porque não tudo?
  • 36. Testes de aceitação tendem:
  • 37. Testes de aceitação tendem: 1. Difícil escrita
  • 38. Testes de aceitação tendem: 1. Difícil escrita 2. Difícil manutenção
  • 39. Testes de aceitação tendem: 1. Difícil escrita 2. Difícil manutenção 3. Execução lenta
  • 40. Testes de aceitação tendem: 1. Difícil escrita 2. Difícil manutenção 3. Execução lenta
  • 41. Testes de aceitação tendem: 1. Difícil escrita 2. Difícil manutenção 3. Execução lenta
  • 42. Testes de aceitação tendem: 1. Difícil escrita 2. Difícil manutenção 3. Execução lenta
  • 43. Testes de aceitação tendem: 1. Difícil escrita 2. Difícil manutenção 3. Execução lenta 4. Feedback demorado
  • 44. Testes de aceitação tendem: 1. Difícil escrita 2. Difícil manutenção 3. Execução lenta 4. Feedback demorado
  • 45. Cenário ideal:
  • 46. Cenário ideal: *quase* ideal
  • 47. Cenário ideal: ideal
  • 48. Por que? Feedback rápido é importante
  • 49. Por que? Feedback rápido é importante
  • 50. Por que? Feedback rápido é importante
  • 51. Por que? Feedback rápido é importante
  • 52. Sugestão
  • 53. Sugestão http://www.infoq.com/br/presentations/o-que-nao-testar