📺 Develpreneur YouTube Episode

Video + transcript

Mobile Testing With Test Project - Part 2

2022-02-15 •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]
okay let's go back over to monitor our
apps ran we can look at the last
execution
we can go look at the reports
and here's our reports okay so my
android test my last test ran
and all the steps passed
however if we look at ios
we come in here so everything
ran and passed so it was able to
self-repair and it was able to execute
look at our agents so we have our
one agent running i have that running up
here
if we have a problem with it or it hangs
we can restart it that does happen
sometimes but not a lot
we can check to see what agents are in a
ready state we can see what agents are
in a disconnected state
talk about integrations
we won't really get into that much today
so let's create a new test let's do new
test let's do mobile
next
and this will be demo
android
or if you want to make these things as
descriptive as possible but for demoing
purposes i'm just being
keeping it short and simple
go next
we'll do android
select your mobile application
so we have our choices put it all
together sample drawer sample drawer one
or
we can add a new application so these
are all previous applications that i've
loaded
so let's add a new application for
testing
so if you have a physical device
attached you can click from device
or if you have an emulator you can pick
the emulator
and then it takes in a moment to scan
the device but then you can select the
applications on the device
so you can actually test like the
browser like we just did with safari so
here we could do maybe chrome see if
this works
if you don't want to load it from the
device you can upload it from an apk
file which is what i did for the react
native project that we did i exported
that to an apk and uploaded it or we can
add it manually so we could actually
load it from code
we're going to keep this very simple
today we're just going to try to kick
off chrome let's click done
and so we got chrome android all looks
good next
let's record a test
now like i said last time we have the
options to record to the cloud or save
our test as a file we'll keep things
simple and just use cloud for now
and start the recording
so as soon as you click start recording
you get your step recorded here on the
left and it tries to open up the
emulator on the right
and this will take a second or two to
load
and if you'll notice we're simulating
what's going on in the actual emulator
reset the application
so it's reset we're back to this page
so the first thing we notice is that
we're recording now
so we've cleared the application data
and the app is now up for testing so we
can come down here and click accept and
continue
and it recorded our click so we clicked
accept and continue this was an android
widget button
we're going to skip the sync section so
we click no thanks
and it catches that as well
now we're on the google page
let's go in here and search for
amazon
it's thinking about something type
amazon search why did we lose oh there
we go okay
so the test api found a better way to
locate your elements during the
recording
so instead of us just typing it
recognize that oh it's an edit text
widget
so we're going to search on a web
address
using the edit text instead of doing a
search box text
so now we're doing an xpath lookup to
find the widget edit text and search or
type web address so we click confirm
and we find amazon and then we look for
this guy here
so we click amazon
and now we're on the amazon google
search
so if we want to scroll
you have to click and drag up
to get your arrow to kind of see how far
you want to scroll so
and there's amazon.com so we want to
click on that
and say we want to search for donuts
okay so we got donuts
and it gives us coffee which is
just fine
all right so we've added 13 steps so
let's pause this
and let's rerun and make sure everything
works so it resets the app
and we essentially go through and click
through our steps
including our mistakes
it's thinking because we're trying to
find amazon.com
yep see self 10 was self healing
so now it's trying to go back
so it looks like it clicked
or it didn't scroll far enough so now
it's going to kind of scroll up and down
the page to find the right search
results
still thinking
but the nice part is it's smart enough
to determine this
so well you may have to do this once or
twice to get your test defined correctly
once it's defined it should be good to
go
so for some reason you start running
your test and things break you can
always reload your tests if you're
running them offline in test project and
they should work
now let's go ahead and stop that
so here we go again
test ai found a better way to locate
your elements so it did not like the
view for amazon.com so it found oh well
we need to do an xpath lookup
and this makes more sense
because it was a google search so this
could change so it needs to do an xpath
lookup to find it
all right so we can save and exit
we now have our demo app we can run it
we can select our agent
now if i run it from this screen
and run it i have to actually go out to
the emulator to see it running so if you
actually have your device connected this
is just a quick and easy way to run the
test on your app without having to go
into the monitor
go and do the screen sharing
and just test it
and it's going to have to think about
because the donuts is slightly different
this time
but that is how we create a android app
all right so next let's walk through
adding an ios app so let's go to mobile
next
and this is going to be a demo
ios
next
ios
so now you have the options of adding a
new application for testing
so we have amazon expo safari so i've
already pre-loaded these
if you have the developer license you
can load the ipa
but because i do not it will not let me
run this so i have to actually add a new
application
so we can again upload the ipa we can
run from code or we can run from device
so if i do iphone 13
oh
i can then look on the device because
the emulator is running
right here so it will give me a list of
all the devices that are available so i
have contacts
right here i have files i have health
maps
mobile calendar and so on so let's try
maps
we've read this before this could go
completely bad but let's give it a shot
so let's do maps
record
keep it default cloud start recording
so we want to select our device and like
i said before when the emulators are
running it's the last device in the list
and we click select
i always takes a little bit longer to
load
and pretty much every time you start a
new test you for mobile you almost
always want to clear and restart
that way you're always starting with the
fresh emulator
so hit yes and that will
ensure the first step gets saved
right so now we're recording
so we'll click continue to take the
default
when we want our settings
we'll say you don't allow
and let's search
maps thinking
so when you try to click something if
you can't find it initially it will
do its logic to find the step so we
found it
all right let's search for
nashville tennessee
there we go nashville tennessee
and let's go to guides
and let's look for
things to do
oh look there's an actual
site so we can click the site
and open up tennessee tourism
so this now should open up
let's say a browser
it's trying to figure out what this
element is
might not be clickable it might be
clicking on the wrong thing
apparently that's not clickable so close
that
and see up here it's thinking
all right so uh maybe we want to do
things to do
there we go
things to do
uh nashville's best photoshop
for photo spots
okay we can then
click
a location
zoom in on it
and you have to be patient when you're
recording these for the first time
because the application does have to
think through what it's trying to do
mobile is a little bit more difficult
than web so
just gonna be a little smarter and then
there's the ramen
all right so let's save this so let's
stop let's run it
actually let's
slow this down just a little bit so we
can see what's going on
let's run
so as you can see it has to
kind of think through what it's doing
because again the first time it's
running this
problem with the
step
again
ah
so if you notice that
welcome page is not there for that first
step i had to do
so i did not need to do
[Music]
that
again
[Music]
click maps open maps
like step 2 still
that was that preference page that
loaded the first time
let's run it again
so now to restart
and just go click the map section now
now it has to think for me because we
move things around
and as you can see it can be
temperamental
but
that one
nashville
just one more time
just now we'll move on after this
there it
goes as you can see it's not perfect
but with a little tweaking and just a
little thinking through the test the
first time
or as you work through your development
cycles and you have to tweak this
you will have to make some adjustments
to your test steps but most of the time
the test project agent should be able to
rectify what it's trying to do
i'm going to go ahead and stop this
and exit
all right so we have our demo android we
have our demo ios
so the last thing i want to show you
today is how to export this code and
look at it inside of eclipse so if we
take our project here
demo android
you have a couple different options you
can do with this project you can move it
to a folder you can share this test with
someone else and let them run it
it's another beautiful feature of test
project is the sharing you can get a
direct link
you can change parameters you can copy
the id
but what we want is this section down
here we want to generate the code
so we want to click back and then you
have your options of java c-sharp python
and then you have test project legacy or
test project open sdk i recommend
sticking with the test project open sdk
give it your project name so this will
be io test project generate my first
project we'll say my first
android project i think i already have
my first project out there
lowercase and then we'll download this
allow
okay code is downloaded so let's go find
our code
so go to downloads
i'm going to copy this to my development
folder
let's go to development
okay i have appium
here's my code
export this
open this guy up
okay so there's my project
and let's go
look at this
from eclipse
okay now we want to import our project
project from the folders next
directory
there's our project click open
finish
there's our project
you notice there's no pom file so the
first thing we need to do is we need to
right click
and we need to
configure this to be maven
or we can even do mobile nature but i
want to get the dependencies so we'll
take maven
on take the defaults
okay so if we go back to our slide
we need these dependencies so we'll go
out to our maven
repository
let's search for our
dependencies for selenium java
take the latest
we'll add the dependencies section
okay there's our selenium
we then need java client for appium
there's appium
try to stay away from betas
try to stick with the latest version
here
and last we need our
test project
there's live java sdks we'll search for
by test project
there we go
and we'll take the latest release
downloaded the dependencies so now our
project compiles
you
Transcript Segments
0.48

[Music]

27.359

okay let's go back over to monitor our

29.359

apps ran we can look at the last

33.04

execution

34.399

we can go look at the reports

36.64

and here's our reports okay so my

39.04

android test my last test ran

41.84

and all the steps passed

44.399

however if we look at ios

47.039

we come in here so everything

49.44

ran and passed so it was able to

51.36

self-repair and it was able to execute

54.559

look at our agents so we have our

56.96

one agent running i have that running up

59.12

here

62.079

if we have a problem with it or it hangs

64.479

we can restart it that does happen

66.4

sometimes but not a lot

69.28

we can check to see what agents are in a

71.04

ready state we can see what agents are

73.439

in a disconnected state

75.68

talk about integrations

77.68

we won't really get into that much today

80.799

so let's create a new test let's do new

84.159

test let's do mobile

87.119

next

88.56

and this will be demo

91.28

android

92.88

or if you want to make these things as

94.32

descriptive as possible but for demoing

96.4

purposes i'm just being

98.88

keeping it short and simple

100.96

go next

102.399

we'll do android

104.479

select your mobile application

106.96

so we have our choices put it all

108.72

together sample drawer sample drawer one

111.6

or

112.399

we can add a new application so these

114.399

are all previous applications that i've

117.36

loaded

118.88

so let's add a new application for

120.88

testing

122.24

so if you have a physical device

124.079

attached you can click from device

127.28

or if you have an emulator you can pick

129.2

the emulator

130.8

and then it takes in a moment to scan

133.12

the device but then you can select the

134.959

applications on the device

137.52

so you can actually test like the

139.2

browser like we just did with safari so

142

here we could do maybe chrome see if

144.239

this works

145.52

if you don't want to load it from the

147.12

device you can upload it from an apk

149.36

file which is what i did for the react

151.92

native project that we did i exported

154.319

that to an apk and uploaded it or we can

157.44

add it manually so we could actually

159.04

load it from code

160.48

we're going to keep this very simple

161.84

today we're just going to try to kick

164.4

off chrome let's click done

167.599

and so we got chrome android all looks

170.08

good next

171.599

let's record a test

174

now like i said last time we have the

175.599

options to record to the cloud or save

178.159

our test as a file we'll keep things

180.319

simple and just use cloud for now

182.8

and start the recording

185.12

so as soon as you click start recording

187.12

you get your step recorded here on the

189.28

left and it tries to open up the

191.36

emulator on the right

193.84

and this will take a second or two to

195.44

load

196.48

and if you'll notice we're simulating

198.879

what's going on in the actual emulator

202.159

reset the application

204.48

so it's reset we're back to this page

207.68

so the first thing we notice is that

209.68

we're recording now

211.519

so we've cleared the application data

213.84

and the app is now up for testing so we

216.4

can come down here and click accept and

219.12

continue

221.28

and it recorded our click so we clicked

223.44

accept and continue this was an android

225.68

widget button

227.36

we're going to skip the sync section so

229.92

we click no thanks

232.08

and it catches that as well

234.64

now we're on the google page

237.36

let's go in here and search for

240.879

amazon

242.239

it's thinking about something type

244.4

amazon search why did we lose oh there

246.959

we go okay

248.159

so the test api found a better way to

250.319

locate your elements during the

251.599

recording

252.64

so instead of us just typing it

255.68

recognize that oh it's an edit text

258.079

widget

259.199

so we're going to search on a web

260.88

address

262.079

using the edit text instead of doing a

264.479

search box text

266.24

so now we're doing an xpath lookup to

268.479

find the widget edit text and search or

271.04

type web address so we click confirm

275.68

and we find amazon and then we look for

279.6

this guy here

282.8

so we click amazon

284.88

and now we're on the amazon google

287.28

search

288.32

so if we want to scroll

290.96

you have to click and drag up

294

to get your arrow to kind of see how far

295.919

you want to scroll so

298

and there's amazon.com so we want to

300.32

click on that

302.8

and say we want to search for donuts

306.08

okay so we got donuts

308

and it gives us coffee which is

311.28

just fine

312.639

all right so we've added 13 steps so

314.96

let's pause this

317.12

and let's rerun and make sure everything

319.36

works so it resets the app

323.12

and we essentially go through and click

325.039

through our steps

331.28

including our mistakes

335.28

it's thinking because we're trying to

336.96

find amazon.com

340.72

yep see self 10 was self healing

344

so now it's trying to go back

346.56

so it looks like it clicked

348.96

or it didn't scroll far enough so now

350.72

it's going to kind of scroll up and down

352.479

the page to find the right search

354.08

results

355.759

still thinking

357.44

but the nice part is it's smart enough

359.44

to determine this

361.039

so well you may have to do this once or

363.039

twice to get your test defined correctly

365.84

once it's defined it should be good to

368.16

go

369.36

so for some reason you start running

371.12

your test and things break you can

373.12

always reload your tests if you're

374.72

running them offline in test project and

377.44

they should work

378.88

now let's go ahead and stop that

381.68

so here we go again

384.16

test ai found a better way to locate

386.319

your elements so it did not like the

387.759

view for amazon.com so it found oh well

390.72

we need to do an xpath lookup

393.44

and this makes more sense

395.36

because it was a google search so this

398.56

could change so it needs to do an xpath

400.88

lookup to find it

403.199

all right so we can save and exit

406.72

we now have our demo app we can run it

411.28

we can select our agent

413.36

now if i run it from this screen

415.599

and run it i have to actually go out to

417.919

the emulator to see it running so if you

420.479

actually have your device connected this

422.319

is just a quick and easy way to run the

425.039

test on your app without having to go

426.72

into the monitor

428

go and do the screen sharing

430.08

and just test it

445.84

and it's going to have to think about

447.039

because the donuts is slightly different

448.96

this time

452.16

but that is how we create a android app

456.88

all right so next let's walk through

458.88

adding an ios app so let's go to mobile

464.08

next

465.759

and this is going to be a demo

468.639

ios

470.4

next

472

ios

473.84

so now you have the options of adding a

475.919

new application for testing

478.879

so we have amazon expo safari so i've

481.12

already pre-loaded these

483.68

if you have the developer license you

485.599

can load the ipa

487.68

but because i do not it will not let me

490.24

run this so i have to actually add a new

492.479

application

493.919

so we can again upload the ipa we can

496.72

run from code or we can run from device

500.879

so if i do iphone 13

505.28

oh

507.199

i can then look on the device because

509.52

the emulator is running

512

right here so it will give me a list of

514.88

all the devices that are available so i

516.959

have contacts

518.8

right here i have files i have health

522.24

maps

523.68

mobile calendar and so on so let's try

526

maps

527.76

we've read this before this could go

529.6

completely bad but let's give it a shot

531.839

so let's do maps

534.32

record

535.839

keep it default cloud start recording

538.959

so we want to select our device and like

541.44

i said before when the emulators are

543.12

running it's the last device in the list

546.56

and we click select

548.48

i always takes a little bit longer to

550.08

load

551.92

and pretty much every time you start a

554.08

new test you for mobile you almost

556.64

always want to clear and restart

559.04

that way you're always starting with the

560.8

fresh emulator

562.72

so hit yes and that will

564.959

ensure the first step gets saved

568.16

right so now we're recording

570.399

so we'll click continue to take the

572.399

default

574

when we want our settings

576.88

we'll say you don't allow

579.36

and let's search

581.92

maps thinking

584.399

so when you try to click something if

586

you can't find it initially it will

588.959

do its logic to find the step so we

591.279

found it

592.48

all right let's search for

594.88

nashville tennessee

596.959

there we go nashville tennessee

599.279

and let's go to guides

604

and let's look for

608

things to do

613.12

oh look there's an actual

615.92

site so we can click the site

619.279

and open up tennessee tourism

622.079

so this now should open up

625.12

let's say a browser

628.88

it's trying to figure out what this

630.64

element is

632.72

might not be clickable it might be

634.32

clicking on the wrong thing

636.72

apparently that's not clickable so close

638.64

that

640.8

and see up here it's thinking

643.68

all right so uh maybe we want to do

648.32

things to do

649.68

there we go

650.8

things to do

653.44

uh nashville's best photoshop

656.16

for photo spots

660.64

okay we can then

662.72

click

664.079

a location

665.36

zoom in on it

667.279

and you have to be patient when you're

669.2

recording these for the first time

670.64

because the application does have to

673.519

think through what it's trying to do

676.32

mobile is a little bit more difficult

678.24

than web so

680.24

just gonna be a little smarter and then

681.839

there's the ramen

684.079

all right so let's save this so let's

686.079

stop let's run it

689.36

actually let's

690.959

slow this down just a little bit so we

692.72

can see what's going on

694.8

let's run

704.24

so as you can see it has to

706.32

kind of think through what it's doing

708.8

because again the first time it's

710

running this

713.76

problem with the

714.839

step

716.399

again

723.92

ah

725.279

so if you notice that

727.279

welcome page is not there for that first

730.8

step i had to do

733.04

so i did not need to do

735.01

[Music]

736.32

that

739.04

again

739.48

[Music]

742.639

click maps open maps

746.399

like step 2 still

749.36

that was that preference page that

751.519

loaded the first time

755.279

let's run it again

759.68

so now to restart

761.76

and just go click the map section now

766.72

now it has to think for me because we

768.16

move things around

771.12

and as you can see it can be

772.48

temperamental

775.519

but

777.6

that one

780.399

nashville

783.04

just one more time

785.68

just now we'll move on after this

790.32

there it

798.839

goes as you can see it's not perfect

802.72

but with a little tweaking and just a

804.88

little thinking through the test the

806.24

first time

807.839

or as you work through your development

810.079

cycles and you have to tweak this

812.399

you will have to make some adjustments

814.079

to your test steps but most of the time

817.44

the test project agent should be able to

820.48

rectify what it's trying to do

825.04

i'm going to go ahead and stop this

828.48

and exit

831.279

all right so we have our demo android we

832.959

have our demo ios

834.8

so the last thing i want to show you

836.48

today is how to export this code and

839.92

look at it inside of eclipse so if we

842.639

take our project here

845.199

demo android

846.8

you have a couple different options you

848.24

can do with this project you can move it

849.839

to a folder you can share this test with

852

someone else and let them run it

854

it's another beautiful feature of test

856.24

project is the sharing you can get a

858.72

direct link

860.24

you can change parameters you can copy

862.079

the id

863.199

but what we want is this section down

864.959

here we want to generate the code

867.68

so we want to click back and then you

870.32

have your options of java c-sharp python

874.16

and then you have test project legacy or

876.8

test project open sdk i recommend

879.519

sticking with the test project open sdk

882.88

give it your project name so this will

885.519

be io test project generate my first

887.92

project we'll say my first

891.04

android project i think i already have

893.199

my first project out there

896

lowercase and then we'll download this

900.399

allow

903.44

okay code is downloaded so let's go find

906.16

our code

908.32

so go to downloads

910.72

i'm going to copy this to my development

912.8

folder

914.48

let's go to development

916.639

okay i have appium

919.6

here's my code

922.48

export this

923.839

open this guy up

925.36

okay so there's my project

928

and let's go

929.6

look at this

930.959

from eclipse

932.8

okay now we want to import our project

936.32

project from the folders next

939.6

directory

941.12

there's our project click open

944.079

finish

945.6

there's our project

947.6

you notice there's no pom file so the

949.6

first thing we need to do is we need to

951.36

right click

952.959

and we need to

955.36

configure this to be maven

958.24

or we can even do mobile nature but i

960.48

want to get the dependencies so we'll

962.639

take maven

964.32

on take the defaults

967.12

okay so if we go back to our slide

970.959

we need these dependencies so we'll go

974

out to our maven

976.24

repository

979.44

let's search for our

980.839

dependencies for selenium java

985.04

take the latest

987.199

we'll add the dependencies section

993.92

okay there's our selenium

996.48

we then need java client for appium

1000.959

there's appium

1003.279

try to stay away from betas

1005.36

try to stick with the latest version

1009.519

here

1011.92

and last we need our

1014

test project

1015.839

there's live java sdks we'll search for

1018.16

by test project

1022.32

there we go

1024.64

and we'll take the latest release

1029.12

downloaded the dependencies so now our

1030.88

project compiles

1047.839

you