1 / 5

BDD

BDD. Behaviour Driven Development Desenvolvimento Guiado por Especificações Comportamentais. BDD x TDD. BDD ~~ TDD troca de ”testes” por ”comportamentos” BDD = TDD + fluência + linguagem ubíqua

Download Presentation

BDD

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. BDD Behaviour Driven Development Desenvolvimento Guiado por Especificações Comportamentais

  2. BDD x TDD BDD ~~ TDD troca de ”testes” por ”comportamentos” BDD = TDD + fluência + linguagem ubíqua + Modelo do Domínio

  3. BDD - Estórias Estórias 1: [Test] 2: public void Transfer_to_cash_account()‏ 3: { 4: 5: Account savings = null; 6: Account cash = null; 8: Story transferStory = new Story("Transfer to cash account"); 10: transferStory 11: .AsA("savings account holder")‏ 12: .IWant("to transfer money from my savings account")‏ 13: .SoThat("I can get cash easily from an ATM");

  4. BDD - Estórias 15: transferStory 16: .WithScenario("Savings account is in credit") 18: .Given("my savings account balance is", 100, delegate(int accountBalance)‏ { savings = new Account(accountBalance); })‏ 19: .And("my cash account balance is", 10, delegate(int accountBalance) { cash = new Account(accountBalance); })‏ 20: .When("I transfer to cash account", 20, delegate(int transferAmount){savings.TransferTo(cash,transferAmount);})‏ 21: .Then("my savings account balance should be", 80, delegate(int expectedBalance) { Assert.AreEqual(expectedBalance, savings.Balance); })‏ 22: .And("my cash account balance should be", 30, delegate(int expectedBalance) { Assert.AreEqual(expectedBalance, cash.Balance); })‏ 23:

  5. BDD - Estórias e Cenários • Estórias transferStory 32: .WithScenario("Savings account is overdrawn")‏ 33: 34: .Given("my savings account balance is", -20)‏ 35: .And("my cash account balance is", 10)‏ 36: .When("I transfer to cash account", 20)‏ 37: .Then("my savings account balance should be", -20)‏ 38: .And("my cash account balance should be", 10); 39: 40: }

More Related