3. Acceptance Test-driven Development
(ATDD)
ATDD is Acceptance Test Driven Development.
In one short sentence: we start with an acceptance test that
describes the functionality we want to implement from users point of
view.
Acceptance tests ideally should be “black box” tests. They should
talk to the application only through the interfaces it exposes.
4. Test-driven Development (TDD)
Test-driven development (TDD) is a software development process
that relies on the repetition of a very short development cycle:
Requirements are turned into very specific test cases, then the
software is improved to pass the new tests, only. This is opposed to
software development that allows software to be added that is not
proven to meet requirements.
6. TDD example
@Test
public void testGetSum() throws Exception {
assertEquals(15, calculator.getSum(7,8));
}
7. TDD example
public class Calculator {
public int getSum(int x, int y) {
return x+y;
}
}
8. TDD example
@Test
public void testGetSum() throws Exception {
assertEquals(15, calculator.getSum(7,8));
}
@Test
public void testGetDivide() throws Exception {
assertEquals(20, calculator.getDivide(100,5));
}
9. TDD example
public class Calculator {
public int getSum(int x, int y) {
return x+y;
}
public int getDivide(int x, int y) {
return x/y;
}
}
10. ATDD example
When one number is used then return value is
that same number
When two numbers are used then return value is
their sum
11. ATDD example
@Test
public final void
whenOneNumberIsUsedThenReturnValueIsThatSameNumber() {
Assert.assertEquals(3, StringCalculator.add("3"));
}
@Test
public final void
whenTwoNumbersAreUsedThenReturnValueIsTheirSum() {
Assert.assertEquals(3+6, StringCalculator.add("3,6"));
}
12. ATDD example
Acceptance Criteria
Given the user has accessed the webapp
The user tries to add a new pet then Pet Name and Pet Status are
both mandatory fields
The user has entered Name and Status then he is able to add data
by clicking on the Create button
The user can see his enters in the List of Pets grid
The user can delete entries using Delete button in the List of Pets grid
17. Why FitNess ?
FitNesse is a tool for specifying and verifying application
acceptance criteria (requirements).
To make it easy for all stakeholders to interact with FitNesse,
requirements can be created and edited through the web browser.
Specifications can be written in wiki syntax or in a rich text editor, so
no knowledge of the wiki syntax is required.
18. Why FitNess ?
Creating tables easily.
Easily translating tables into calls to the system under test.
Allowing ease and flexibility in documenting tests.
Possibility crate acceptance test without dip knowledge in the any
of software languages
19. Acceptance test example in FitNess
Acceptance Criteria
Given the user has accessed the webapp
20.
21. public void startApplication() {
logger.debug("startApplication is called.");
@SuppressWarnings("deprecation")
WebDriver myDriver = handler.initializeDriver(getSettings()
.getSeleniumServer(), String.valueOf(getSettings()
.getSeleniumPort()), getSettings().getBrowserName(), "3000");
logger.debug("setDriver is called next.");
setDriver(myDriver);
if (driver() == null) {
logger.error("The WebDriver seems not to be initialized - further actions
are abandoned");
abandonStorytest();
}
driver().get(getSettings().getApplicationRoot());
}
22. public void waitForElementPresent(String locator, String timeOut) {
logger.debug("[waitForElementPresent] waits " + timeOut + " for locator:" + locator);
int timeOutInSeconds = (Integer.parseInt(timeOut) / 1000);
Wait<WebDriver> wait = new WebDriverWait(driver(), timeOutInSeconds);
try {
wait.until(visibilityOfElementLocated(locator));
} catch (Exception e) {
throw new SeleniumException("The Element appears not in the certain amount of
time.");
}
}
23. Acceptance test example in FitNess
Acceptance Criteria
The user has entered Name and Status then he is able to add data
by clicking on the Create button
26. Experience in using FitNess in the
enterprise development
First expression : This is overhead , Java (WebDriver + Junit) it is
enough
27. Experience in using FitNess in the
enterprise development
First expression : This is overhead , Java (WebDriver + Junit) it is enough
No more test cases and test suits
28. Experience in using FitNess in the
enterprise development
First expression : This is overhead , Java (WebDriver + Junit) it is enough
No more test cases and test suits
No more steps to reproduce in bug report
29. Experience in using FitNess in the
enterprise development
First expression : This is overhead , Java (WebDriver + Junit) it is enough
No more test cases and test suits
No more steps to reproduce in bug report
Business analytics and PO can create automation tests
30. Experience in using FitNess in the
enterprise development
First expression : This is overhead , Java (WebDriver + Junit) it is enough
No more test cases and test suits
No more steps to reproduce in bug report
Business analytics and PO can create automation tests
All story documentation can be in one place
31. Experience in using FitNess in the
enterprise development
First expression : This is overhead , Java (WebDriver + Junit) it is enough
No more test cases and test suits
No more steps to reproduce in bug report
Business analytics and PO can create automation tests
All story documentation can be in one place
And it is only one place when you can found how your system works
in reality
32. Experience in using FitNess in the
enterprise development
First expression : This is overhead , Java (WebDriver + Junit) it is enough
No more test cases and test suits
No more steps to reproduce in bug report
Business analytics and PO can create automation tests
All story documentation can be in one place
And it is only one place when you can found how your system works in reality
Step by step you can switch to ATDD approach