test and docs: hand in hand

29
Test and Docs: Hand in Hand Shauvik Roy Choudhary, PhD Founder, MoQuality https://moquality.com

Upload: shauvik-roy-choudhary-phd

Post on 14-Apr-2017

145 views

Category:

Engineering


0 download

TRANSCRIPT

Test and Docs: Hand in HandShauvik Roy Choudhary, PhD

Founder, MoQuality

https://moquality.com

Documentation: Developer v End-user

Developing Apps is Hard …

Photo credits: blog.fullstory.com

YourApp

Expectations / Background

Device CapabilityLanguages / Symbols

Other apps installed

Network conditions

Usage patterns Distant from servers

User is King

I need a ONE CHANCE

I need a

ONE CHANCE

How do we create docs today?

Online Help

In-App Help

Source: helpstack.ioSource: Google Maps App

In-App Chat

Source: intercom.io Source: smooch.io

Walkthroughs / Hints

So, what’s the problem?

1. DIFFERENCE (existing)

2. CHANGE (new)

AppVersion 1

AppVersion 2

Tests have the same problem

Regression Testing

AppVersion 1

TestsVersion 1 ?

AppVersion 2

PASS

FAIL CHANGE IN THE APP

OR

Idea: Test Reports could become Docs

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(Matcher) .perform(ViewAction) .check(ViewAssertion)

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

Ok, i’m sold.How can Tests generate Docs ?

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

DocTest Tool

Tests

DocTest AndroidEmulator

Or DeviceAppium

Test Reports Docs

https://github.com/moquality/doctest

Thanks!Parting thoughts:

Does your app have End-user Docs?Would you reuse Test Reports as Docs?