Skip to content

Instantly share code, notes, and snippets.

View carolinemusyoka's full-sized avatar
:octocat:
so?.let { it -> be (it) }

Carol carolinemusyoka

:octocat:
so?.let { it -> be (it) }
View GitHub Profile
@carolinemusyoka
carolinemusyoka / Robot Pattern.md
Created March 26, 2020 11:38 — forked from bharatdodeja/Robot Pattern.md
Android UI testing using Espresso and Robot pattern

Android UI Testing using Espresso, Rotton Pattern and Kotlin DSL

Espresso allow UI tests to have stable interactions with your app, but without discipline these tests can become hard to manage and require frequent updating. Robot pattern allows you to create stable, readable, and maintainable tests with the aid of Kotlin’s language features.

Test Excecution

Let's say there is a login screen and user needs to login access dashboard by entering email and password and clicking on the login button. This is what we want the test to validate. But there’s also the how. Really, what we are looking for is the what.

Traditional Testing (Problem)

A way that you might write the test is something like this:

import africastalking
username = "africa username" # use 'sandbox' for development in the test environment
# use your sandbox app API key for development in the test environment
api_key = "africa's talking api key"
africastalking.initialize(username, api_key)
# # Use the service synchronously