test and docs: hand in hand
TRANSCRIPT
YourApp
Expectations / Background
Device CapabilityLanguages / Symbols
Other apps installed
Network conditions
Usage patterns Distant from servers
Test Structure (JUnit 4)@Before
public void runBeforeEveryTest() {/*Setup*/}
@Test
public void actualTest() {
result = doAction();
assertTrue(result);
}
@After
public void runAfterEveryTest() {/*Teardown*/}
Example Test Actions: Espresso
onView(withId(R.id.greeting)).perform(click());
onView(withText("Hello Steve!")) .check(matches(isDisplayed()));
Example Test Actions: Appium
driver.findElement(By.id(“Greeting”)) .click();
driver.findElement(By.id(“Text Field”)) .sendKeys(“Hello World!”);
Detour: Test Capture (Recording)
Android Studio Test Recordergenerates Espresso Tests
Barista App for recording testsgenerates
Espresso, Appium & UIAutomator Tests
http://moquality.com/barista
BDD: Readable Tests and Test ReportsFeature: Adding item to Todo list
Scenario: Add item in Empty todo list
Given The Todo list is empty
When The user clicks “Add Task” button
And The user enters “item A” in “EditText”
And The user presses “ADD” button
Then Todo list contains “item A”
Feature: Adding item to Todo list
Scenario: Add item in Empty todo list
Given The Todo list is empty
When The user clicks “Add Task” button
And The user enters “item A” in “EditText”
And The user presses “ADD” button
Then Todo list contains “item A”
Generating better Test ReportsGoals:
● Still have Reliable Tests
● Generate easy to read end user docs
○ With detailed steps
○ With latest screenshots