📺 Develpreneur YouTube Episode

Video + transcript

Mobile Testing With Test Project - Part 1

2022-02-10 •Youtube

Detailed Notes

Welcome, if you are a tester or developer interested in mobile application automation testing or are new to test automation tools than you defiantly need to check out TestProject. However, if you are not familiar with this tool that's OK. In Mobile Testing With Test Project we cover all the basics necessary to start mobile testing in Test Project 2.0.

TestProject is a community driven tool and has a free forever plan that is fully featured and that you can get started with in moments. In addition they have a lot of documentation that will help you with all the details you need to use TestProject to create effective test automation that your whole team can use.

Before you begin you will need to:

First, go back to the previous video on Test Project A Review of Version 2.0 and watch the section on setup. In addition, you will need to start the Test Project Agent so that Test Project can record against you local simulators and mobile devices. However, depending on your mobile device will determine what you will need to install and set up next. At this point, you will need Android Studio for Android development, Xcode / iOS Simulator for iOS, or both if you are going to be testing on both types of devices. Finally, if you plan on running your mobile tests out side of test project in a then you will need to export your tests to code. As a result you will need to have an IDE like Eclipse and run them using Appium

Transcript Text
[Music]
all right welcome
today we are going to be covering the
second part of test project which is
using test project for mobile testing
we are going to look at how to set up a
mobile device for testing
look at how to create a test project
mobile test we're going to record a
mobile test with a simulator and a
device
and we're going to execute and run the
mobile test
there are some tools you'll need to get
started
if you are going to use test project you
need to install the test project agent
so if you haven't done that already go
back to the previous video on test
project and follow the steps to install
the agent
you will also need android studio
eclipse
some maven dependencies
and xcode and an ios simulator if you're
on a mac
in java
when we export our mobile test or any of
our test project tests to code we're
going to need some java maven
dependencies in order to use these
or run this code from java or from
eclipse we'll need to make sure we
include selenium
selenium java we need to get io java
client and i o test project
for mobile testing
when you export your mobile tests they
export to appium so you'll need the
appium client
we have not discussed appium
in any of our classes to date so i'm
going to keep this very high level when
i discuss appium but i will be doing a
future presentation on how to set up and
run mobile testing with that view in the
future
so let's get started
the slides for now
first
if you're on a mac
you need to do a few things to get
started so the first thing you want to
do is you want to open up xcode
so once xcode loads
you can go under the xcode option and go
to
where is it here it is so xcode open
developer tools you want to open up the
simulator app
now the first time you open this
you want to bookmark it you want to make
sure you
either pin it add it to
create a shortcut to it or something
because really you don't want xcode open
because it's a good memory drain on your
device but you do need the ios simulator
and this can run separate from xcode
the other thing you want to do is you're
going to want to install
if you're doing android development you
want to make sure that you install
android studios
and once you install android studios
and you get it running you need to come
down here to the more action section
if you click that you want to go to the
avd manager
and you need to actually start one of
your virtual devices for android
now if you have a device kicking around
for android
you can go ahead and plug it into your
machine
and test project will recognize your
device as long as it's a fairly recent
device
i found out with the last update that
all my devices are so archaic they won't
load because i can't load the latest
android operating system
so unfortunately running this on device
i won't be able to do today but i will
show you through emulators
the other caveat for running it with
device if you are trying to use ios
and you want to do this on windows you
will need an apple developer license so
you will need to register to get apple
developer id so that you can actually
interact with your device real time
through test project
so that's the setup so if you do those
first and get your emulators running
it's going to make your life a whole lot
easier once you get into test project
so now we open up our browser and we log
into test project
so once we log in it takes us to our
project page where
we have our previous examples for doctor
who and my first test from last
presentation and i have two new tests in
here i have one for ios and one for
android
so i'm going to put this to the right
here
so let's run these so let's run the ios
so when i click run it asks me okay
which project do i want to run this one
i called it my first agent
and i currently have iphone 13 pro
running so i'll slide down to the bottom
here
and for some reason and i don't know why
test project likes to put all your
running emulators or your devices at the
bottom of the list so you have to scroll
all the way to the bottom to find the
one that you want
however once you find the devices you
can
click this and it will show you only the
ones that you want to see
all right so we'll go down we'll take
this guy
click next
one thing that is recommended is that
you always override the default input
parameters unless you have a data source
and for this simple test i'm just going
to override the input parameters and run
with what's in my test
i click run
and while that one's running i'm going
to click run for android because you can
run these in parallel and as you can see
it sees our android device so i will
select this one as well
and click next
and i will again use the defaults
so while these are running i'm going to
switch over to our monitor so we can see
what's going on
so here's our monitor
our tests are preparing
so iphone just reset
so it's reset back to default and so did
android and as you can see on the
android emulator it was actually it's
going to run our default app that we
were running in react native
however apple because i don't have my
apple id it's expired
i couldn't deploy
our sdk or the api to
iphone so instead we're just running a
test testing the safari app going
through and trying to purchase an ipad
pro
so what you're seeing there on the
iphone
is i did a couple slides sliding back
down
and then i'm going to select the 11 inch
display
and then i selected gray and the test
completed so 100 it was now that it's
finished it's going to shut down the
agent
up here is our little monitor this will
tell us what is running so we have no
workers running at the moment so just
finished
and it's done so one of the reasons you
want to make sure that you reset your
device every time you run is when you're
running with emulation one of the things
i've noticed a lot is that when the test
ends it doesn't clean up after itself it
just leaves the app or the emulator
in the state like the final state of the
test
so that's one thing that it's a little
annoying so if we go into our test so
let's go into our android test here
here are the steps that we actually ran
so if i click in here this is a neat
little option with test project so well
yes we have our emulators here and we
can watch the test run in the emulators
we can also click view device and it
will open up a screen mirror to our
emulator or to our physical device
it just takes it a second to set up
mirroring and then once it's done we
will see the device
this step takes just a second or two
ios takes a little bit longer
but just before i run this
let's just click through our app so if
we click menu settings
go to home you can see this is the full
react native app that i did
for our react native presentation
i just exported it out of react native
into our emulator
so now if i want to run this test i will
click run
and the very first thing it does is it
clears the application data and
and then down here at the bottom it
tells you what it's doing so we click
notifications we clicked home
and it was very quick
now if i go to the left here and i click
test i can actually slow this down so we
can actually see what's going on so i
can go to slow
and let's save that
and then let's run this again
so we reset the app go to notifications
go to home
go to menu go to settings
go back to home one and done and we can
even slow that down even more
because as we're testing things we
really want to see what's going on we
want to make sure things are working the
way it's supposed to work
back to home and test is done
now the trick is though once you get
done scripting your test you want to run
these as fast as possible so that you
can actually run multiple tests and get
through as much of a regression as
possible so now if i kick up the fastest
and click run this should be almost
lickety split
whoops see it went so fast it jumped a
step
so what's interesting with test project
is it will try to find figure out what
went wrong and it will try to auto
correct itself
so you don't have to constantly go back
in and say oh okay that ran too fast
test failed
no what happens is it goes back and says
oh
i got here but really i was supposed to
be here
so what happened is it self-repaired so
test project kind of has that ai logic
in it to determine where things kind of
went off the rails and maybe goes back
and tries to correct itself
and it will tell you when it's doing
that
so we realized okay maybe running fast
was too fast so let's go back to normal
and rerun normal
the other thing we have here is we have
adaptive weights so we can be minimal
patient very patient so the adaptive
weights if you think back to
our selenium talks this is that weight
where we can do the implicit or the
explicit weight and if we fail
just like in test ng
and with selenium we can take
screenshots of our failures so we can
see where things went wrong
and if we want we can turn on the
automation assistant it's on by default
if we turn it off then it won't try to
autocorrect if the test fails or if it
jumps ahead
so let's just run this one more time to
make sure i didn't break anything
okay good
all right so we're going to save and
exit out of that test
so now let's go look at ios
so ios is a little different if we view
our device
now you have to have the emulator
running if you really want to view the
device for testing
you could come up here and actually view
the virtual device
however if you do that sometimes xcode
and the simulator sometimes they cross
talk with each other and they get
confused and then one takes ownership
over the other and then you can't really
run the test
if that happens you just have to shut
down all the emulators
in worst case scenario you would have to
come back over here to ios
or to your iphone
go up to the device
and erase all content and settings this
basically puts it back to a fresh
restart
and when you run the test again you'll
reinstall the test project agent onto
the device and then it will start over
but as you can see we're mirroring so if
i actually change something here if i go
back
we will see we go back in the emulator
so we can keep this guy minimized and
just work within our browser
again for ios
so we have our
name
we have the application we're running
so if i actually had wanted to test the
rest assured project
i could deploy it here the problem is
because i don't have that apple
developer id i could not register it to
the device so the device would actually
have to be one of the approved devices
for
testing or simulating a test for a new
development app
we can set our execution speeds our
weights and everything else is the same
go back over here to steps and we click
run
so we start out with our step name
we reset the app so we're back to home
everything looks good we open up safari
yep
so figured out i had to go back and
reset the browser
so we're basically scrolling through the
main page of the apple site i'm swiping
up
i click buy ipad
ipad pro
and i'm going to swipe up again
so see oops can't find it
so taking another look so what it's
doing and what i think it's doing is
it's essentially walking back through
the steps to see if one of the previous
steps got skipped
and then it it determines oh while we're
here
that's not where we're supposed to be so
we went a little too fast so it goes
back figures out where it's supposed to
be and then it runs the step if the step
works then it continues from there
if it doesn't
and if it's like an id issue it scans
the elements on the page here that it
can find
and see and starts clicking and starts
trying to self-repair itself
so it looks like this guy's going to
fail because either the site has changed
or one of the elements has changed
so really you don't want to do
web page testing on a mobile app to this
degree
on a site that is totally dependent on
maybe angular or randomly changing
constantly because of advertisement
or you'd be very
careful on what you select on the page
to click on
some other things we can add we can add
some test parameters we can add some
project parameters
we have our locator so we can look up by
id xpath tag name just like selenium
like we talked about last time
and you can explore the path so you can
explore the dom tree of the app and walk
through and look at the different things
and
check out the actions the validations
the attributes so now that this has
changed from
what we talked about last time it's just
the same except now we're dealing with a
mobile app
it's pretty cool
so i like their the way they treat this
they treat it just like a dom just like
a web page and you're essentially doing
the same type of testing with the mobile
app that you would with a web page
you
Transcript Segments
0.44

[Music]

27.84

all right welcome

29.279

today we are going to be covering the

31.84

second part of test project which is

34.88

using test project for mobile testing

38.64

we are going to look at how to set up a

40.559

mobile device for testing

42.399

look at how to create a test project

44.8

mobile test we're going to record a

47.039

mobile test with a simulator and a

49.12

device

50.48

and we're going to execute and run the

52.399

mobile test

55.36

there are some tools you'll need to get

56.719

started

57.84

if you are going to use test project you

60.32

need to install the test project agent

62.719

so if you haven't done that already go

64.64

back to the previous video on test

66.64

project and follow the steps to install

68.96

the agent

71.439

you will also need android studio

74.479

eclipse

75.759

some maven dependencies

77.68

and xcode and an ios simulator if you're

80.799

on a mac

83.6

in java

84.96

when we export our mobile test or any of

88.56

our test project tests to code we're

91.119

going to need some java maven

93.439

dependencies in order to use these

96.24

or run this code from java or from

99.2

eclipse we'll need to make sure we

101.2

include selenium

102.72

selenium java we need to get io java

106.079

client and i o test project

109.84

for mobile testing

111.68

when you export your mobile tests they

114.079

export to appium so you'll need the

116.32

appium client

118.24

we have not discussed appium

120.24

in any of our classes to date so i'm

123.04

going to keep this very high level when

124.799

i discuss appium but i will be doing a

127.119

future presentation on how to set up and

129.039

run mobile testing with that view in the

130.72

future

131.84

so let's get started

133.599

the slides for now

136.16

first

137.12

if you're on a mac

139.36

you need to do a few things to get

141.44

started so the first thing you want to

143.599

do is you want to open up xcode

147.04

so once xcode loads

149.52

you can go under the xcode option and go

152.959

to

153.92

where is it here it is so xcode open

156.319

developer tools you want to open up the

158.64

simulator app

160.56

now the first time you open this

162.64

you want to bookmark it you want to make

164.56

sure you

165.68

either pin it add it to

167.76

create a shortcut to it or something

169.84

because really you don't want xcode open

172.4

because it's a good memory drain on your

174.56

device but you do need the ios simulator

177.76

and this can run separate from xcode

180.72

the other thing you want to do is you're

182.56

going to want to install

184.56

if you're doing android development you

186.4

want to make sure that you install

188.959

android studios

191.599

and once you install android studios

194.64

and you get it running you need to come

196.879

down here to the more action section

199.68

if you click that you want to go to the

201.76

avd manager

204.239

and you need to actually start one of

207.04

your virtual devices for android

209.76

now if you have a device kicking around

211.36

for android

212.4

you can go ahead and plug it into your

214.48

machine

215.519

and test project will recognize your

218.159

device as long as it's a fairly recent

220.08

device

221.28

i found out with the last update that

223.12

all my devices are so archaic they won't

226.319

load because i can't load the latest

228.959

android operating system

230.879

so unfortunately running this on device

233.04

i won't be able to do today but i will

235.12

show you through emulators

237.519

the other caveat for running it with

239.68

device if you are trying to use ios

242.799

and you want to do this on windows you

244.959

will need an apple developer license so

247.84

you will need to register to get apple

250.319

developer id so that you can actually

252.48

interact with your device real time

255.04

through test project

257.199

so that's the setup so if you do those

260

first and get your emulators running

262.16

it's going to make your life a whole lot

263.6

easier once you get into test project

266.16

so now we open up our browser and we log

269.6

into test project

271.12

so once we log in it takes us to our

273.36

project page where

275.84

we have our previous examples for doctor

278.24

who and my first test from last

280.84

presentation and i have two new tests in

283.36

here i have one for ios and one for

285.28

android

286.479

so i'm going to put this to the right

288.08

here

289.6

so let's run these so let's run the ios

293.12

so when i click run it asks me okay

295.52

which project do i want to run this one

298.08

i called it my first agent

300.479

and i currently have iphone 13 pro

302.8

running so i'll slide down to the bottom

304.8

here

305.84

and for some reason and i don't know why

308.32

test project likes to put all your

310.72

running emulators or your devices at the

313.44

bottom of the list so you have to scroll

315.28

all the way to the bottom to find the

317.36

one that you want

318.639

however once you find the devices you

321.199

can

322.4

click this and it will show you only the

324.16

ones that you want to see

326.16

all right so we'll go down we'll take

328.08

this guy

329.12

click next

331.039

one thing that is recommended is that

332.72

you always override the default input

334.72

parameters unless you have a data source

338.24

and for this simple test i'm just going

340.32

to override the input parameters and run

342.72

with what's in my test

345.28

i click run

346.88

and while that one's running i'm going

348.4

to click run for android because you can

350.16

run these in parallel and as you can see

352.88

it sees our android device so i will

355.28

select this one as well

357.199

and click next

359.039

and i will again use the defaults

362.24

so while these are running i'm going to

363.919

switch over to our monitor so we can see

366.24

what's going on

368.16

so here's our monitor

370

our tests are preparing

371.919

so iphone just reset

374.56

so it's reset back to default and so did

376.96

android and as you can see on the

378.88

android emulator it was actually it's

381.28

going to run our default app that we

383.68

were running in react native

386.24

however apple because i don't have my

388.639

apple id it's expired

390.639

i couldn't deploy

392.319

our sdk or the api to

395.84

iphone so instead we're just running a

398.08

test testing the safari app going

400.8

through and trying to purchase an ipad

402.479

pro

405.12

so what you're seeing there on the

406.319

iphone

407.44

is i did a couple slides sliding back

410.08

down

411.12

and then i'm going to select the 11 inch

413.52

display

415.28

and then i selected gray and the test

417.52

completed so 100 it was now that it's

420.72

finished it's going to shut down the

422.16

agent

424.56

up here is our little monitor this will

427.12

tell us what is running so we have no

429.28

workers running at the moment so just

431.28

finished

432.72

and it's done so one of the reasons you

435.599

want to make sure that you reset your

437.28

device every time you run is when you're

439.599

running with emulation one of the things

441.84

i've noticed a lot is that when the test

444.16

ends it doesn't clean up after itself it

446.319

just leaves the app or the emulator

449.44

in the state like the final state of the

452.08

test

453.12

so that's one thing that it's a little

455.599

annoying so if we go into our test so

458.16

let's go into our android test here

461.36

here are the steps that we actually ran

464.56

so if i click in here this is a neat

466.96

little option with test project so well

469.84

yes we have our emulators here and we

471.68

can watch the test run in the emulators

474.08

we can also click view device and it

477.199

will open up a screen mirror to our

479.599

emulator or to our physical device

483.52

it just takes it a second to set up

485.039

mirroring and then once it's done we

487.039

will see the device

488.639

this step takes just a second or two

491.599

ios takes a little bit longer

494.08

but just before i run this

496.4

let's just click through our app so if

498.16

we click menu settings

500.879

go to home you can see this is the full

503.12

react native app that i did

505.199

for our react native presentation

507.36

i just exported it out of react native

509.52

into our emulator

511.28

so now if i want to run this test i will

513.2

click run

514.479

and the very first thing it does is it

516.32

clears the application data and

519.839

and then down here at the bottom it

521.44

tells you what it's doing so we click

522.719

notifications we clicked home

525.279

and it was very quick

527.2

now if i go to the left here and i click

530.08

test i can actually slow this down so we

533.92

can actually see what's going on so i

535.6

can go to slow

538.399

and let's save that

540.08

and then let's run this again

542.48

so we reset the app go to notifications

545.279

go to home

546.72

go to menu go to settings

549.2

go back to home one and done and we can

551.76

even slow that down even more

554.32

because as we're testing things we

555.76

really want to see what's going on we

557.279

want to make sure things are working the

558.72

way it's supposed to work

561.12

back to home and test is done

563.92

now the trick is though once you get

566.24

done scripting your test you want to run

568.32

these as fast as possible so that you

570.08

can actually run multiple tests and get

573.12

through as much of a regression as

574.8

possible so now if i kick up the fastest

576.8

and click run this should be almost

578.399

lickety split

581.04

whoops see it went so fast it jumped a

583.92

step

584.88

so what's interesting with test project

587.44

is it will try to find figure out what

590

went wrong and it will try to auto

592.08

correct itself

593.519

so you don't have to constantly go back

595.279

in and say oh okay that ran too fast

598.08

test failed

599.839

no what happens is it goes back and says

602.32

oh

603.2

i got here but really i was supposed to

605.76

be here

607.2

so what happened is it self-repaired so

611.04

test project kind of has that ai logic

613.519

in it to determine where things kind of

616

went off the rails and maybe goes back

618.32

and tries to correct itself

620

and it will tell you when it's doing

621.519

that

622.48

so we realized okay maybe running fast

625.36

was too fast so let's go back to normal

628.24

and rerun normal

630.48

the other thing we have here is we have

632.16

adaptive weights so we can be minimal

634.959

patient very patient so the adaptive

637.2

weights if you think back to

639.44

our selenium talks this is that weight

642.48

where we can do the implicit or the

644.32

explicit weight and if we fail

648.16

just like in test ng

649.92

and with selenium we can take

651.76

screenshots of our failures so we can

654.399

see where things went wrong

656

and if we want we can turn on the

657.92

automation assistant it's on by default

660.32

if we turn it off then it won't try to

662.48

autocorrect if the test fails or if it

665.04

jumps ahead

666.56

so let's just run this one more time to

668

make sure i didn't break anything

674.16

okay good

676

all right so we're going to save and

677.279

exit out of that test

679.68

so now let's go look at ios

681.76

so ios is a little different if we view

685.279

our device

686.399

now you have to have the emulator

689.12

running if you really want to view the

691.279

device for testing

692.959

you could come up here and actually view

696.399

the virtual device

697.92

however if you do that sometimes xcode

701.36

and the simulator sometimes they cross

703.36

talk with each other and they get

704.48

confused and then one takes ownership

707.12

over the other and then you can't really

708.72

run the test

710.24

if that happens you just have to shut

712

down all the emulators

713.92

in worst case scenario you would have to

716.32

come back over here to ios

718.88

or to your iphone

720.48

go up to the device

722.24

and erase all content and settings this

724.88

basically puts it back to a fresh

726.56

restart

727.68

and when you run the test again you'll

729.68

reinstall the test project agent onto

732.88

the device and then it will start over

735.2

but as you can see we're mirroring so if

737.279

i actually change something here if i go

740.079

back

741.68

we will see we go back in the emulator

744.079

so we can keep this guy minimized and

746.24

just work within our browser

749.279

again for ios

751.279

so we have our

752.72

name

753.519

we have the application we're running

755.68

so if i actually had wanted to test the

758.48

rest assured project

760.32

i could deploy it here the problem is

763.36

because i don't have that apple

764.639

developer id i could not register it to

767.519

the device so the device would actually

769.36

have to be one of the approved devices

772.16

for

773.04

testing or simulating a test for a new

775.92

development app

777.6

we can set our execution speeds our

780

weights and everything else is the same

782.8

go back over here to steps and we click

784.959

run

786.639

so we start out with our step name

789.76

we reset the app so we're back to home

792.32

everything looks good we open up safari

801.519

yep

802.48

so figured out i had to go back and

805.04

reset the browser

809.279

so we're basically scrolling through the

811.12

main page of the apple site i'm swiping

814.72

up

815.44

i click buy ipad

817.839

ipad pro

819.44

and i'm going to swipe up again

821.839

so see oops can't find it

824.56

so taking another look so what it's

826.399

doing and what i think it's doing is

829.04

it's essentially walking back through

831.12

the steps to see if one of the previous

832.88

steps got skipped

834.8

and then it it determines oh while we're

837.519

here

839.04

that's not where we're supposed to be so

840.48

we went a little too fast so it goes

842.32

back figures out where it's supposed to

843.839

be and then it runs the step if the step

846.16

works then it continues from there

848.32

if it doesn't

849.839

and if it's like an id issue it scans

852.639

the elements on the page here that it

855.44

can find

856.399

and see and starts clicking and starts

858.24

trying to self-repair itself

861.279

so it looks like this guy's going to

862.72

fail because either the site has changed

865.279

or one of the elements has changed

868.399

so really you don't want to do

871.199

web page testing on a mobile app to this

873.36

degree

874.48

on a site that is totally dependent on

876.959

maybe angular or randomly changing

879.279

constantly because of advertisement

881.92

or you'd be very

883.44

careful on what you select on the page

885.839

to click on

888.24

some other things we can add we can add

889.76

some test parameters we can add some

891.519

project parameters

893.6

we have our locator so we can look up by

895.68

id xpath tag name just like selenium

898.32

like we talked about last time

900.56

and you can explore the path so you can

903.6

explore the dom tree of the app and walk

905.839

through and look at the different things

907.6

and

908.399

check out the actions the validations

910.16

the attributes so now that this has

912

changed from

914.16

what we talked about last time it's just

916.24

the same except now we're dealing with a

917.68

mobile app

919.519

it's pretty cool

921.68

so i like their the way they treat this

924

they treat it just like a dom just like

925.68

a web page and you're essentially doing

928.56

the same type of testing with the mobile

930.959

app that you would with a web page

948.32

you