Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
TDD Overview
1. Test Driven Development
Embrace Uncertainty
Naresh Jain
Twitter: @nashjain
http://blogs.agilefaqs.com
Licensed Under Creative Commons by Naresh Jain
Friday, October 2, 2009 1
34. Pick one scenario and in relation to your scenario, what are the
specific observable results that will tell you that the activity has
been successfully completed?
Friday, October 2, 2009 18
35. Pick one scenario and in relation to your scenario, what are the
specific observable results that will tell you that the activity has
been successfully completed?
Going out for Movie (THX sound and Digital projection)
Friday, October 2, 2009 18
36. Pick one scenario and in relation to your scenario, what are the
specific observable results that will tell you that the activity has
been successfully completed?
Going out for Movie (THX sound and Digital projection)
Going out for meal (one veg.)
Friday, October 2, 2009 18
37. Pick one scenario and in relation to your scenario, what are the
specific observable results that will tell you that the activity has
been successfully completed?
Going out for Movie (THX sound and Digital projection)
Going out for meal (one veg.)
Going shopping ($50)
[10 Minutes]
Friday, October 2, 2009 18
38. Pick one scenario and in relation to your scenario, what are the
specific observable results that will tell you that the activity has
been successfully completed?
Going out for Movie (THX sound and Digital projection)
Going out for meal (one veg.)
Going shopping ($50)
[10 Minutes]
Present back to the group your findings. [3 minutes per group]
Friday, October 2, 2009 18
39. Acceptance Criteria
and Tests
A critical piece of Agile
Friday, October 2, 2009 19
40. Acceptance Criteria
Is a set of conditions that the Story must meet for it to be accepted
as complete
Is typically provided by the customer or product owner.
Is not a replacement for conversation.
Is one of the results of the conversation
Acceptance Criteria are NOT tests
Friday, October 2, 2009 20
41. Given [Precondition]
When [Actor + Action]
Then [Observable Result]
Friday, October 2, 2009 21
44. Demo
Roman Numerals to Decimal Conversion Example
Friday, October 2, 2009 23
45. 1 May 1 Jul 1 Sep 1 Nov
Analysis
Design
Implementation
ERD
DFD
DD
ST
Friday, October 2, 2009 24
46. Business Facing
Are we building the right product?
Are we building the product right?
Technology/Implementation Facing
Friday, October 2, 2009 25
47. Brian Marick’s
Test Categorization
Business Facing
Supports Programming
Critique product
Technology/Implementation Facing
Friday, October 2, 2009 26
48. It Helps to think...
Business Facing
Drives Development
Critique product
Technology/Implementation Facing
Friday, October 2, 2009 27
49. It Helps to think...
Business Facing
Drives Development
Critique product
Unit Testing
Technology/Implementation Facing
Friday, October 2, 2009 27
50. It Helps to think...
Business Facing
Acceptance Testing
Drives Development
Low-fi prototypes
Critique product
Unit Testing
Technology/Implementation Facing
Friday, October 2, 2009 27
51. It Helps to think...
Business Facing
Acceptance Testing Exploratory Testing
Drives Development
Low-fi prototypes UI and Usability Testing
Critique product
Unit Testing
Technology/Implementation Facing
Friday, October 2, 2009 27
52. It Helps to think...
Business Facing
Acceptance Testing Exploratory Testing
Drives Development
Low-fi prototypes UI and Usability Testing
Critique product
Performance Testing
Unit Testing
System Tests
Technology/Implementation Facing
Friday, October 2, 2009 27
57. Acceptance Test Driven
Iteration
Automated
Acceptance
Acceptance Tests
Criteria
Story
Friday, October 2, 2009 28
58. Acceptance Test Driven
Iteration
Automated
Acceptance
Acceptance Tests
Criteria
Automated
Story Unit Test
Friday, October 2, 2009 28
59. Acceptance Test Driven
Iteration
Automated
Acceptance
Acceptance Tests
Criteria
Automated
Story Unit Test
Automated
Acceptance
Tests
Friday, October 2, 2009 28
60. Acceptance Test Driven
Iteration
Automated
Acceptance
Acceptance Tests
Criteria
Automated
Story Unit Test
Automated
Acceptance
Tests
Exploratory
Testing
Friday, October 2, 2009 28
61. Acceptance Test Driven
Iteration
Automated
Acceptance
Acceptance Tests
Criteria
Automated
Story Unit Test
Automated
Acceptance
Tests
Acceptance
Exploratory Criteria
Testing
Friday, October 2, 2009 28
62. Acceptance Test Driven
Iteration
Automated
Acceptance
Acceptance Tests
Criteria
Automated
Story Unit Test
Automated
UI Tests
Automated
Acceptance
Tests
Acceptance
Exploratory Criteria
Testing
Friday, October 2, 2009 28
63. Acceptance Test Driven
Iteration
Automated
Acceptance P
Acceptance Tests E
Criteria R
F
O
Automated R
Story Unit Test M T
Automated E E
UI Tests N S
C T
E S
Automated
Acceptance
Tests
Acceptance
Exploratory Criteria
Testing
Friday, October 2, 2009 28
66. Mike Cohn’s Testing Pyramid
Small in Number
GUI Tools: Selenium, Sahi, Watir, Abbot, Frankenstein
Tests
Friday, October 2, 2009 29
67. Mike Cohn’s Testing Pyramid
Small in Number
GUI Tools: Selenium, Sahi, Watir, Abbot, Frankenstein
Tests
Acceptance
Tests
Friday, October 2, 2009 29
68. Mike Cohn’s Testing Pyramid
Small in Number
GUI Tools: Selenium, Sahi, Watir, Abbot, Frankenstein
Tests
Acceptance At least one per story
Tools: Fit, FitNesse, RSpec, Cucumber
Tests
Friday, October 2, 2009 29
69. Mike Cohn’s Testing Pyramid
Small in Number
GUI Tools: Selenium, Sahi, Watir, Abbot, Frankenstein
Tests
Acceptance At least one per story
Tools: Fit, FitNesse, RSpec, Cucumber
Tests
Unit Tests
Friday, October 2, 2009 29
70. Mike Cohn’s Testing Pyramid
Small in Number
GUI Tools: Selenium, Sahi, Watir, Abbot, Frankenstein
Tests
Acceptance At least one per story
Tools: Fit, FitNesse, RSpec, Cucumber
Tests
At least one per class or module
Tools: xUnit, TestNG
Unit Tests
Friday, October 2, 2009 29
71. Acceptance Tests View
UI
Model and Presenter
Business Tier
Data Store
Friday, October 2, 2009 30
101. Avatars of TDD
Rule of Diversity
Distrust all claims for “One True Way”
Friday, October 2, 2009 56
102. Business Facing
Drives Development
Critique product
Inside Out
Outside In
Technology/Implementation Facing
Brian Marick’s Test Categorization
Friday, October 2, 2009 57
103. Veterinarian
Information System
Friday, October 2, 2009 58
104. Outside In: ATDD
Fitnesse Document:
Assertions: 17 right, 0 wrong, 0 ignored, 0 exceptions
com.vis.billing.fixtures.PaidCashBill
procedure details on the bill
account details
name cost
account number patient name owner name
Routine Office Visit 250
1001 Fluffy Dave Atkins
Rabies Vaccination 50
procedure details
pay Cash
name cost
patient name? owner name? account number? bill no? payment method? amount paid?
Routine Office Visit 250
Fluffy Dave Atkins 1001 1 Cash 300
Rabies Vaccination 50
bill check paid true
account number? owner name? patient name? total? paid?
1001 Dave Atkins Fluffy 300 false check total 0
Friday, October 2, 2009 59
108. Inside Out: Unit TDD
public class ClinicTest {
private Clinic clinic = new Clinic();
@Test public class BillableTest {
public void amountOnTheReceiptShouldMatchBillableAmount() throws Exception {
Billable billable = new Billable() { private static final Account daveSAccount = new Account(101, "Dave");
public int totalAmount() { return 0; } private static final List<Service> services = new ArrayList<Service>();
};
Account dave = new Account(101, "Dave"); @Test
public void totalBillableAmountShouldBeZeroIfNoServicesAreProvided() {
Receipt rcpt = clinic.payCash(dave, billable); Billable bill = new Bill(daveSAccount, services);
assertEquals("Amount on receipt does match procedure cost", billable.totalAmount(), assertEquals("Total amount is not Zero", 0, bill.totalAmount());
rcpt.getAmount()); }
}
@Test
@Test public void totalBillableAmountShouldBeTotalOfEachServiceProvided() {
public void customerPayesBillableAmountForCashTransaction() throws Exception { services.add(new Procedure("Rabies Vaccination", 250));
final int billableAmount = 56; services.add(new Procedure("Regular office Visit", 50));
class AmountCharged { int charged; };
final AmountCharged charged = new AmountCharged(); Billable bill = new Bill(daveSAccount, services);
Billable billable = new Billable() { assertEquals("Total Amount is not 300", 300, bill.totalAmount());
public int totalAmount() { }
return billableAmount;
} @After
}; public void cleanUp() {
services.clear();
Account dave = new Account(101, "Dave") { }
public void charge(int amount) { }
charged.charged = amount;
}
};
clinic.payCash(dave, billable);
assertEquals("Account is not charged billable amount", billableAmount,charged.charged);
}
}
Friday, October 2, 2009 63