Topics
- why do automated testing
- challenges and solutions
- UIAutomation and beyond
- hands on with Frank
Slide 8
Slide 8 text
interrupt,
ask questions,
generally heckle
Please
Slide 9
Slide 9 text
why do we test?
Slide 10
Slide 10 text
why do we test?
interacting with the
app to see what it does
Slide 11
Slide 11 text
“does it work?”
Slide 12
Slide 12 text
“does it still work?”
Slide 13
Slide 13 text
“what’s it supposed
to do anyway?”
Slide 14
Slide 14 text
but computers are ...
and we’re not very
good at it ...
manual testing
is tedious ...
Slide 15
Slide 15 text
“Computers are designed to do simple
repetitive tasks. The second you have
humans doing repetitive tasks, all the
computers get together late at night
and laugh at you…”
- Neal Ford
Slide 16
Slide 16 text
... so automate
your UI testing*
* within reason
Slide 17
Slide 17 text
UIAutomation:
Apple’s solution
Slide 18
Slide 18 text
UIAutomation
- runs inside Instruments
- write test scripts in javascript
- drives simulator or device
- lives outside of the wider
test automation ecosystem
Slide 19
Slide 19 text
No content
Slide 20
Slide 20 text
DEMO!
Slide 21
Slide 21 text
UI testing:
challenges
and
solutions
Slide 22
Slide 22 text
a basic test script
touch “textField marked:‘login’”
type_into_keyboard “testuser”
touch “textField marked:‘password’”
type_into_keyboard ‘testpassword’
touch “button marked:‘Login’”
Slide 23
Slide 23 text
a basic test script
touch “textField marked:‘login’”
type_into_keyboard “testuser”
touch “textField marked:‘password’”
type_into_keyboard ‘testpassword’
touch “button marked:‘Login’”
Slide 24
Slide 24 text
a basic test script
touch “textField marked:‘login’”
type_into_keyboard “testuser”
touch “textField marked:‘password’”
type_into_keyboard ‘testpassword’
touch “button marked:‘Login’”
PROBLEM!
no
abstractions
Slide 25
Slide 25 text
cucumber
SOLUTION:
Slide 26
Slide 26 text
writes tests which
describe behavior
in terms of user value
Slide 27
Slide 27 text
Given, When, Then
Scenario: prompted to log in
Given I am on the home screen
But I am not logged in
When I tap the Friends button
Then I should be on the log in screen
Slide 28
Slide 28 text
how does that
magic work?
Slide 29
Slide 29 text
regular
expressions*
* oh the humanity!
Slide 30
Slide 30 text
Given I am on the home screen
But I am not logged in
When I tap the Friends button
Then I should be on the log in screen
Cucumber steps
Slide 31
Slide 31 text
Cucumber step
definitions
Slide 32
Slide 32 text
Cucumber step
definitions
When /^I tap the Friends button$/ do
touch( “button marked:‘Friends’” )
end
Slide 33
Slide 33 text
Cucumber step
definitions
When /^I tap the Friends button$/ do
touch( “button marked:‘Friends’” )
end
Slide 34
Slide 34 text
Cucumber step
definitions
When /^I tap the Friends button$/ do
touch( “button marked:‘Friends’” )
end
When /^I log in as "(.*?)"$/ do |user|
password = password_for_user(user)
touch “textField marked:‘login’”
type_into_keyboard user
touch “textField marked:‘password’”
type_into_keyboard password
touch “button marked:‘Login’”
end
Slide 39
Slide 39 text
When /^I log in as "(.*?)"$/ do |user|
password = password_for_user(user)
touch “textField marked:‘login’”
type_into_keyboard user
touch “textField marked:‘password’”
type_into_keyboard password
touch “button marked:‘Login’”
end
Slide 40
Slide 40 text
When /^I log in as "(.*?)"$/ do |user|
password = password_for_user(user)
touch “textField marked:‘login’”
type_into_keyboard user
touch “textField marked:‘password’”
type_into_keyboard password
touch “button marked:‘Login’”
end
Slide 41
Slide 41 text
When /^I log in as "(.*?)"$/ do |user|
password = password_for_user(user)
touch “textField marked:‘login’”
type_into_keyboard user
touch “textField marked:‘password’”
type_into_keyboard password
touch “button marked:‘Login’”
end
Slide 42
Slide 42 text
When I log in as “tom”
Slide 43
Slide 43 text
When I log in as “dick”
Slide 44
Slide 44 text
When I log in as “harry”
Slide 45
Slide 45 text
cucumber isn’t the
only option
Slide 46
Slide 46 text
selecting views
Slide 47
Slide 47 text
No content
Slide 48
Slide 48 text
No content
Slide 49
Slide 49 text
select the view
labeled ‘Shopping List’
Slide 50
Slide 50 text
select the view
labeled ‘Shopping List’
Slide 51
Slide 51 text
select the view
labeled ‘Shopping List’
Slide 52
Slide 52 text
select the view
labeled ‘Shopping List’
PROBLEM!
too generic
Slide 53
Slide 53 text
select the view
labeled ‘Shopping List’
SOLUTION:
get specific
Slide 54
Slide 54 text
select the table cell
labeled ‘Shopping List’
SOLUTION:
get specific
Slide 55
Slide 55 text
No content
Slide 56
Slide 56 text
select the table cell
labeled “Ham”?
Slide 57
Slide 57 text
select the table cell
labeled “Ham”?
select the check box
labeled “Ham”?
Slide 58
Slide 58 text
select the table cell
labeled “Ham”?
select the check box
labeled “Ham”?
select the 2nd check
box?
Slide 59
Slide 59 text
PROBLEM!
brittle tests
select the table cell
labeled “Ham”?
select the check box
labeled “Ham”?
select the 2nd check
box?