1 of 29

Test and Docs: Hand in Hand

Shauvik Roy Choudhary, PhD

Founder, MoQuality

https://moquality.com

2 of 29

Documentation: Developer v End-user

3 of 29

Developing Apps is Hard …

Photo credits: blog.fullstory.com

4 of 29

Your

App

Expectations / Background

Device Capability

Languages / Symbols

Other apps installed

Network conditions

Usage patterns

Distant from servers

5 of 29

User is King

6 of 29

I need a ONE CHANCE

I need a

ONE CHANCE

7 of 29

How do we create docs today?

8 of 29

Online Help

9 of 29

In-App Help

Source: helpstack.io

Source: Google Maps App

10 of 29

In-App Chat

Source: intercom.io

Source: smooch.io

11 of 29

Walkthroughs / Hints

12 of 29

Video promos

13 of 29

So, what’s the problem?

14 of 29

  1. DIFFERENCE (existing)

15 of 29

  • CHANGE (new)

App

Version 1

App

Version 2

16 of 29

Tests have the same problem

17 of 29

Regression Testing

App

Version 1

Tests

Version 1

?

App

Version 2

PASS

FAIL

CHANGE

IN THE APP

OR

18 of 29

Idea:

Test Reports could become Docs

19 of 29

Test Structure (JUnit 4)

@Beforepublic void runBeforeEveryTest() {/*Setup*/}

@Testpublic void actualTest() {� result = doAction();� assertTrue(result);�}

@Afterpublic void runAfterEveryTest() {/*Teardown*/}

20 of 29

Example Test Actions: Espresso

onView(Matcher)

.perform(ViewAction)

.check(ViewAssertion)

21 of 29

Example Test Actions: Espresso

onView(withId(R.id.greeting))

.perform(click());

onView(withText("Hello Steve!"))

.check(matches(isDisplayed()));

22 of 29

Example Test Actions: Appium

driver.findElement(By.id(“Greeting))� .click();

driver.findElement(By.id(“Text Field”))� .sendKeys(“Hello World!”);

23 of 29

Detour: Test Capture (Recording)

Android Studio Test Recorder

generates Espresso Tests

Barista App for recording tests

generates

Espresso, Appium & UIAutomator Tests

http://moquality.com/barista

24 of 29

Ok, i’m sold.

How can Tests generate Docs ?

25 of 29

BDD: Readable Tests and Test Reports

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”

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”

26 of 29

Generating better Test Reports

Goals:

  • Still have Reliable Tests
  • Generate easy to read end user docs
    • With detailed steps
    • With latest screenshots

27 of 29

DocTest Tool

Tests

DocTest

Android

Emulator

Or Device

Appium

Test Reports

Docs

28 of 29

https://github.com/moquality/doctest

29 of 29

Thanks!

Parting thoughts:

Does your app have End-user Docs?

Would you reuse Test Reports as Docs?