I, For One, Welcome Our New Robot Overlords

52
I, For One, Welcome Our New Robot Overlords Accepting Mobile Automated Testing into your Heart

Transcript of I, For One, Welcome Our New Robot Overlords

Page 1: I, For One, Welcome Our New Robot Overlords

I, For One, Welcome Our New Robot Overlords

Accepting Mobile Automated Testing into your Heart

Page 2: I, For One, Welcome Our New Robot Overlords

About Me:• Engineer at MEDL

Mobile• Been doing Android

& iOS development for 4 years

Page 3: I, For One, Welcome Our New Robot Overlords

How many of you have a dedicated QA group?

Page 4: I, For One, Welcome Our New Robot Overlords

How many of you are doing automated testing?

Page 5: I, For One, Welcome Our New Robot Overlords

Old projects: small army of manual testers

Page 6: I, For One, Welcome Our New Robot Overlords

New projects: only one or two testers

Page 7: I, For One, Welcome Our New Robot Overlords

Manual Testing Problems

Testers must be in the officeTroubles with reproducingFlaky error casesTakes lots of time

Page 8: I, For One, Welcome Our New Robot Overlords

I, for one, welcome our new robotic overlords

Page 9: I, For One, Welcome Our New Robot Overlords

Pros of manual testing

Testers invent new ways of going through the appIf something is out of place, they can exploit it right awayCan tell you how aggravating some of your flows are

Page 10: I, For One, Welcome Our New Robot Overlords

“Don’t abandon manual testing completely”

- Me(and your QA department)

Page 11: I, For One, Welcome Our New Robot Overlords
Page 12: I, For One, Welcome Our New Robot Overlords

Levels of Testing

Page 13: I, For One, Welcome Our New Robot Overlords

Unit TestsSmall, independent testsTests only a small chunk of a classFast to runWritten mostly by developers

Page 14: I, For One, Welcome Our New Robot Overlords

Functional TestsTest entire featureCut across large sections of the appCan be written by developers, QA, or product owners

Page 15: I, For One, Welcome Our New Robot Overlords

Needs from a testing solution

Has to support iOS and AndroidOne set of test cases shared between both apps

Page 16: I, For One, Welcome Our New Robot Overlords

Needs from a testing solution

Needs to be quick to pick up and set up

Page 17: I, For One, Welcome Our New Robot Overlords

Needs from a testing solution

Needs to be understandable/usable by non-technical people

Page 18: I, For One, Welcome Our New Robot Overlords

UIAutomation/UIAutomator

iOS/Android specific frameworksOne is Javascript, the other Java.Tests are not portable between platforms

Page 19: I, For One, Welcome Our New Robot Overlords

CucumberTests are written in plain language“Given”, “When”, “Then”Desired by teams interested in Agile

Page 20: I, For One, Welcome Our New Robot Overlords

CalabashCucumber support, Ruby codeMany built-in step definitions for mobile testsiOS and Android can use the same steps & step definitionsFREE!

Page 21: I, For One, Welcome Our New Robot Overlords

How to write Cucumber/Calab

ash tests

Page 22: I, For One, Welcome Our New Robot Overlords

Feature: Running a testAs a DeveloperI want a sample featureSo I can begin testing quickly

Page 23: I, For One, Welcome Our New Robot Overlords

Feature: Running a testAs a DeveloperI want a sample featureSo I can begin testing quickly

Scenario: Logging inGiven I am about to loginWhen I login as “User”Then I should see “My

Profile

Page 24: I, For One, Welcome Our New Robot Overlords

Feature: Running a testAs a DeveloperI want a sample featureSo I can begin testing quickly

Scenario: Logging inGiven I am about to loginWhen I login as “User”Then I should see “My

ProfileScenario: Invalid Login

Given I am about to loginWhen I login as “BadUser”Then I should see “Invalid

Credentials”

Page 25: I, For One, Welcome Our New Robot Overlords

Feature: Running a testAs a DeveloperI want a sample featureSo I can begin testing quickly

@validScenario: Logging in

Given I am about to loginWhen I login as “User”Then I should see “My

Profile@invalidScenario: Invalid Login

Given I am about to loginWhen I login as “BadUser”Then I should see “Invalid

Credentials”

Page 26: I, For One, Welcome Our New Robot Overlords

Step DefinitionsGiven(/^I am about to login$/) do

…end

Page 27: I, For One, Welcome Our New Robot Overlords

Step DefinitionsGiven(/^I am about to login$/) do

…end

When(/^I login as “(.*?)”$/) do |user|…end

Page 28: I, For One, Welcome Our New Robot Overlords

It’s Just Ruby Code!

Page 29: I, For One, Welcome Our New Robot Overlords

Step DefinitionsWhen(/^I login as “(.*?)”$/) do |user|

…end

Page 30: I, For One, Welcome Our New Robot Overlords

Step DefinitionsWhen(/^I login as “(.*?)”$/) do |user|

…end

USERS = {BadUser: {username: ‘baduser’,password: ‘BadPassword’

}}

Page 31: I, For One, Welcome Our New Robot Overlords

Step DefinitionsWhen(/^I login as “(.*?)”$/) do |user|user = USERS[:user]touch(“Username”)keyboard_enter_text(user[:username

])touch(“Password”)keyboard_enter_text(user[:password]

)touch(“Login”)end

Page 32: I, For One, Welcome Our New Robot Overlords

Writing Good Tests

Page 33: I, For One, Welcome Our New Robot Overlords

Bad Tests are worse than no tests

Page 34: I, For One, Welcome Our New Robot Overlords

Good tests should be slightly verbose

Page 35: I, For One, Welcome Our New Robot Overlords

TestLoginShouldFailWithInvalidCredentails

vs

LoginTest45

Page 36: I, For One, Welcome Our New Robot Overlords

Good Tests should be Concise

Page 37: I, For One, Welcome Our New Robot Overlords

Given I am on the Welcome ScreenThen I press the Welcome buttonThen I tap the Username fieldAnd I type "username"Then I tap the Password fieldAnd I type "badPassword"And I tap the Login buttonThen I should see “Invalid Login"

Page 38: I, For One, Welcome Our New Robot Overlords

Given I am on the Welcome ScreenThen I press the Welcome buttonThen I tap the Username fieldAnd I type "username"Then I tap the Password fieldAnd I type "badPassword"And I tap the Login buttonThen I should see “Invalid Login"

Given I am about to loginWhen I log in as “BadUser”Then I should see “Invalid Login"

Page 39: I, For One, Welcome Our New Robot Overlords

Good tests should be flexible

Page 40: I, For One, Welcome Our New Robot Overlords

NOT

Page 41: I, For One, Welcome Our New Robot Overlords

Good Tests must be independent

Page 42: I, For One, Welcome Our New Robot Overlords
Page 43: I, For One, Welcome Our New Robot Overlords

Good Tests should be run often

Page 44: I, For One, Welcome Our New Robot Overlords
Page 45: I, For One, Welcome Our New Robot Overlords

Good Tests should not know too much about what they’re testing

Page 46: I, For One, Welcome Our New Robot Overlords

- (void)testSquare { assertEquals([sut squareOf:2], 2*2);}

Page 47: I, For One, Welcome Our New Robot Overlords

- (void)testSquare { assertEquals([sut squareOf:2], 2*2);}

- (void)testSquare { assertEquals([sut squareOf:2], 4);}

Page 48: I, For One, Welcome Our New Robot Overlords

Manual testing is on a decline

Page 49: I, For One, Welcome Our New Robot Overlords

Explored solutions for automated testing

Page 50: I, For One, Welcome Our New Robot Overlords

Saw what goes into a Cucumber test

Page 51: I, For One, Welcome Our New Robot Overlords

What makes a good test

Page 52: I, For One, Welcome Our New Robot Overlords

FinSteve Malsam

[email protected]@s73v3r

+SteveMalsam