Skip to content





Apptest Execution

The instructions below show how to find the app's name, and how to open the app within a Feature File.

Like UI Steps, Apptests require Views defined in a .uisteps file as well one or more Stepdefs to automate them. The Apptest Feature File must first address the phone being used. It must then include a step that opens the app.

Find the App Name

If the app's name is unknown, execute the following from the command line. This will list all available apps and their launchable activities.

Syntax

1
aapt dump badging <pathToApk Path>

Parameter

  • pathToApk - The path to where the apk is stored

Example

1
aapt dump badging /Desktop/spotify.apk

The output will include information similar to the following. In the image below, com.spotify.music is the app's name. When creating a test case, the app can either be referred to by its name, or an expression (including a Context Object).

alt text

Address the Phone

For instructions on different ways to address a phone, refer to the Addressing Phones section.

Open the App

Open the app on the phone. After this step, all steps that involve browsing activities must refer to the named phone. This is similar to Steps scenarios, where all steps which involve browsing activities refer to the browser's name.

Syntax

1
Then open app <app Expression|String|Identifier> on <phone Identifier>

Parameters

  • app - The app's name

  • phone - The name assigned to the phone

Important! If there are Context Objects with the same name as the expression used to define the app name, the value of the context objects will be used as the app name instead of the name provided.

Example with Expression/Context Object

1
2
3
4
5
6
7
  Given an Android phone as A with profile myphone
  Then open app musicApp on A
  And on A, go to main page
  And on A, navigate to Add-ons page
  And define addonName as "Data Package"
  And define phoneUnit as "Data Package"
  And on A, book addon addonName

In the example above, a Context Object is used, and musicApp is evaluated as com.spotify.music.

Associated Context Object

1
2
3
ContextObjects{
musicApp = "com.spotify.music"
}

Example with String

1
2
3
4
5
6
7
  Given an Android phone as A with profile myphone
  Then open app "spotify" on A
  And on A, go to main page
  And on A, navigate to Add-ons page
  And define addonName as "Data Package"
  And define phoneUnit as "Data Package"
  And on A, book addon addonName