Scripting Guidelines
The scripting guideline is to help users write/modify their automation scripts to be compatible with MOZARK App Functional platform. The Language-Framework supported on the platform are:
- Robot-Appium with Python
- Robot-UIAutomator with Python
- Appium with Java TestNG
Robot-Appium
This section describes how to configure, package, and upload your Robot-Appium tests to App Functional.
Please refer to our sample build and sample scripts for Robot-Appium with Python:
Android(Build): View on BitBucket
iOS(Build): View on BitBucket
Android(Mobile Website): View on BitBucket
iOS(Mobile Website): View on BitBucket
Use the below instructions to get started with Robot-Appium scripting on App Functional.
1. Ensure that the Test Package conforms to below folder structure
You will have to create a particular folder structure for your test package. Refer to our sample folder given in Figure 45. This folder structure will ensure that all the dependencies and packages are available.

Figure 45: Folder Structure
Please note:
To ensure the appropriate setup for your Robot-Appium scripts while uploading your test package on App Functional, generate requirements.txt and bundle it inside your test directory/package as given in Figure 45. You can run the below command to generate requirements.txt:
pip freeze > requirements.txt
The following code snippet is a glimpse of requirements.txt:
robotframework-appiumlibrary==1.5.0.7
– Appium-Python-Client [required: >=0.28, installed: 1.0.2]
– selenium [required: >=3.14.1,<4, installed: 3.141.0]
– urllib3 [required: Any, installed: 1.26.2]
– decorator [required: >=3.3.2, installed: 4.4.2]
– docutils [required: >=0.8.1, installed: 0.16]
– kitchen [required: >=1.2.4, installed: 1.2.6]
– robotframework [required: >=2.6.0, installed: 3.2.2]
– selenium [required: >=2.47.1, installed: 3.141.0]
– urllib3 [required: Any, installed: 1.26.2]
– six [required: >=1.10.0, installed: 1.15.0]
setuptools==49.2.1
2. Configure your test package
Replace all hard-coded variables in the config.py file, such as Device UDID, Appium Server IP etc with environment variables, to ensure compatibility. Environment variables represent values that are used by your automated tests. App Functional dynamically populates environment variables at runtime by giving the values to the required environment variables.
- Go to MyScriptTestDirectory/VariableFiles/Config.py
- Add code snippet – import os
- Update the below capabilities with the mentioned environment variables
Capabilities |
Description |
Values |
Udid |
Unique device identifier for the device under test |
os.environ[‘DEVICE_SERIAL_ID’] |
platformVersion |
Mobile OS version for the device under test |
os.environ[‘DEVICE_OS_VERSION’] |
appiumServer |
Appium server IP address |
os.environ[‘APPIUM_SERVER’] |
chromedriverPort |
Port number assigned to chrome browser application. This is only required for tests on the default browsers for mobile websites. |
os.environ[‘CHROME_PORT’] |
systemPort |
To connect with Appium server. This is only required for tests on the default browsers for mobile websites. |
os.environ[‘SYSTEM_PORT’] |
- Add supported environment variables or desired capabilities (Supported variables are a set of desired capabilities that can be used while writing testcases.)
Capabilities |
Description |
Values |
deviceName |
Model name of the device |
os.environ[‘DEVICE_NAME’] |
phoneNumber |
Phone number of the device. This may be used to verify OTP flows. |
os.environ[‘DEVICE_PHONE_NUMBER’] |
mjpegPort |
To take screenshots with the script. |
os.environ[‘MJPEG_PORT’] |
Please note:
- Put username and password for GMAIL login, Facebook login as part of the script if there is any testcase that requires such credentials.
- Rectify all the build errors and missing dependencies before bundling and uploading your test package to App Functional.
3. Upload the test package(scripts) to App Functional
- Sign in to App Functional console: http://demo-appfunctional.mozark.ai/
- Create or select a project. Follow the instructions on how to create or select a project.
- Upload or select a build. Follow the instructions on how to create or select a project.
- Bundle your test package
- Upload the test package. Follow the instructions on how to upload a test script.
Please refer to our sample build and sample scripts for Robot-Appium with Python:
Android(Build): View on BitBucket
iOS(Build): View on BitBucket
Android(Mobile Website): View on BitBucket
iOS(Mobile Website): View on BitBucket
Robot-UIAutomator
This section describes how to configure, package, and upload your Robot-UIAutomator tests to App Functional. The UIAutomator testing framework provides a set of APIs to build user interface tests that perform interactions on user and system apps for Android.
Please refer to our sample build and sample scripts for Robot-UIAutomator with Python for Android(Build): View on BitBucket
Use the below instructions to get started with Robot-UIAutomator scripting on App Functional.
1. Ensure that the Test Package conforms to below folder structure
You will have to create a particular folder structure for your test package. Refer to our sample folder given in Figure 46. This folder structure will ensure that all the dependencies and packages are being taken care of.

Figure 46: Folder Structure
Please note:
To ensure the appropriate setup for your Robot-Appium scripts while uploading your test package on App Functional, generate requirements.txt and bundle it inside your test directory/package as given in Figure 46. You can run the below command:
pip freeze > requirements.txt
The following code snippet is a glimpse of requirements.txt:
robotframework-uiautomatorlibrary==0.4
– uiautomator [required: >=0.1.30, installed: 1.0.2]
– urllib3 [required: >=1.7.1, installed: 1.26.2]
setuptools==49.2.1
2. Configure your test package
Replace all hard-coded variables in the config.py file, such as Device UDID, Appium Server IP etc with environment variables, to ensure compatibility. Environment variables represent values that are used by your automated tests. App Functional dynamically populates environment variables at runtime by giving the values to the required environment variables.
- Go to MyScriptTestDirectory/VariableFiles/Config.py
- Add code snippet – import os
- Update the below capabilities with the mentioned environment variables
Capabilities |
Description |
Values |
Udid |
Unique device identifier for the device under test |
os.environ[‘DEVICE_SERIAL_ID’] |
platformVersion |
Mobile OS version for the device under test |
os.environ[‘DEVICE_OS_VERSION’] |
- Add supported environment variables or desired capabilities (Supported variables are a set of desired capabilities that can be used while writing testcases.)
Capabilities |
Description |
Values |
deviceName |
Model name of the device |
os.environ[‘DEVICE_NAME’] |
phoneNumber |
Phone number of the device. This may be used to verify OTP flows. |
os.environ[‘DEVICE_PHONE_NUMBER’] |
mjpegPort |
To take screenshots with the script. |
os.environ[‘MJPEG_PORT’] |
Please note:
- Put username and password for GMAIL login, Facebook login as part of the script if there is any testcase that requires such credentials.
- Rectify all the build errors and missing dependencies before bundling and uploading your test package to App Functional.
3. Upload the test package(scripts) to App Functional
- Sign in to App Functional console: http://demo-appfunctional.mozark.ai/
- Create or select a project. Follow the instructions on how to create or select a project.
- Upload or select a build. Follow the instructions on how to create or select a project.
- Bundle your test package
- Upload the test package. Follow the instructions on how to upload a test script.
Please refer to our sample build and sample scripts for Robot-UIAutomator with Python for Android(Build): View on BitBucket
Appium Java TestNG
This section describes how to configure, package, and upload your Appium tests to App Functional. Appium is an open-source tool for automating native and mobile web applications. For more information, see Introduction to Appium on the Appium website.
Please refer to our sample build and sample scripts for Appium with Java TestNG
Android(Build): View on BitBucket
iOS(Build): View on BitBucket
1. Ensure that the Test Package conforms to below folder structure
You will have to create a particular folder structure for your test package. Refer to our sample folder given in Figure 47. This folder structure will ensure that all the dependencies and packages are available.

Figure 47: Folder Structure for Appium with Java TestNG Scripts
Please note:
- Add Maven dependencies and builds to pom.xml as given in the folder structure in Figure 47.
<dependencies>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.4.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId> com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>Aquamark</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/zip.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Add dependencies to zip.xml as given in the folder structure in Figure 47.
<assembly
xmlns=”http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=”http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0”
“http://maven.apache.org/xsd/assembly-1.1.0.xsd”>
<id>zip</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>./</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>./</outputDirectory>
<includes>
<include>/dependency-jars/</include>
</includes>
</fileSet>
</fileSets>
</assembly>
2. Configure your test package
Step 01: Write the environment variables or desired capabilities to MyTest.json
Environment variables represent values that are used by your automated tests. You can use these environment variables in your MyTest.json and test code. App Functional dynamically populates environment variables at runtime by giving the values to the required environment variables.
Capabilities |
Description |
Values |
platformName |
Mobile OS platform to use |
Eg: iOS, Android, or FirefoxOS |
platformVersion |
Mobile OS version to use |
Eg: 7.1, 4.4 |
deviceName |
Kind of mobile device to use |
Eg: Galaxy S4, iPhone 11
For Android devices, run adb devices
For iOS devices, run instruments -s devices |
appPackage |
Java package of the app you want to run. |
Run adb shell dumpsys window | grep -E ‘mCurrentFocus’
Output is of the format appPackage/appActivity and fetch appPackage s the value. Open the app on a real device connected via USB(with USB debugging on) before running adb shell command. |
appActivity |
Activity name for the Android activity you want to launch from your package. |
Run adb shell dumpsys window | grep -E ‘mCurrentFocus’
Output is of the format appPackage/appActivity and fetch appActivity as the value. Open the app on a real device connected via USB(with USB debugging on) before running adb shell command. |
appiumURL |
Appium server IP address |
Eg: http://127.0.0.1:4723/wd/hub |
xcodeSigningId |
The first part of the “Common Name” associated with the developer certificate when iOS devices are used |
Eg: iPhone Developer but could be something different for you if you are automating a different iOS device. |
xcodeOrgId |
ID of the Developer Team which signed the certificate used to create the app for iOS devices |
Eg: Q9WV46GA95 It is the “Organizational Unit” value. |
bundleId |
The special iOS-internal name of our app, which is set in the same app-settings form where we selected our Team in Xcode |
Eg: io.appium.TestApp Put a value which is correct for your app. |
Please note:
- The desired capabilities – ‘xcodeSigningId’, ‘xcodeOrgId’, ‘bundleId’ must be added for iOS devices and not for Android devices.
Step 02: Add the filepath of MyTest.json to an environment variable
- Open terminal(MacOS/Linux) or command line(Windows)
- Initialize “DESIRED_CAPABILITIES_FILE_PATH” with the filepath of MyTest.json by executing the below command:
For terminal (MacOS/Linux):
export DESIRED_CAPABILITIES_FILE_PATH=<filepath of MyTest.json>
For command line (Windows):
set DESIRED_CAPABILITIES_FILE_PATH=<filepath of MyTest.json>
- Open Eclipse app from terminal (MacOS/Linux) or command line (Windows)
- Use the below method to BaseClass.java to read the filepath of MyTest.json file from an environment variable in the folder structure:
System.getenv(“DESIRED_CAPABILITIES_FILE_PATH”);
Step 03: Create a zipped test package file
mvn clean package -DskipTests=true
The target directory file path will be: java_testng_appium_android/target/java_testng_appium_android.zip
The sample file name of .zip file will be(in the case of 5GMark): java_testng_appium_android.zip
The file with .zip extension will be created as a result. This is your test package.
Please note:
- Put username and password for GMAIL login, Facebook login as part of the script if there is any testcase that requires such credentials.
- Rectify all the build errors and missing dependencies before bundling your test package.
Step 04: Bundle to create your zipped test package file for App Functional
Now, create a test bundle for App Functional by zipping MyTest.json and .zip file created in previous two steps as MyTestPackage.zip to upload your tests to App Functional.
3. Upload the test package(scripts) to App Functional
- Sign in to App Functional console: http://demo-appfunctional.mozark.ai/
- Create or select a project. Follow the instructions on how to create or select a project.
- Upload or select a build. Follow the instructions on how to create or select a project.
- Upload the MyTestPackage.zip as test script. Follow the instructions on how to upload a test script.
Please refer to our sample build and sample scripts for Appium with Java TestNG
Android(Build): View on BitBucket
iOS(Build): View on BitBucket
TestNG Cucumber Appium with Java
This section describes how to configure, package, and upload your TestNG based Cucumber-Appium with Java tests to App Functional.
Please refer to our sample build and sample scripts for TestNG Cucumber using Appium with Java.
Android(Build): View on BitBucket
1. Ensure that the Test Package conforms to below folder structure
You will have to create a particular folder structure for your test package. Refer to our sample folder given in Figure 48. This folder structure will ensure that all the dependencies and packages are available.

Figure 48: Folder Structure for Appium with Java to support TestNG Cucumber Scripts
Please note:
- Add Maven dependencies and builds to pom.xml as given in the folder structure in Figure 47.
<dependencies>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.4.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId> com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>6.10.3</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>6.10.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>Aquamark</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/zip.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Add dependencies to zip.xml as given in the folder structure in Figure 47.
<assembly
xmlns=”http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=”http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0”
“http://maven.apache.org/xsd/assembly-1.1.0.xsd”>
<id>zip</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>./</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>./</outputDirectory>
<includes>
<include>/dependency-jars/</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>./</outputDirectory>
<includes>
<include>/src/</include>
</includes>
</fileSet>
</fileSets>
</assembly>
2. Configure your test package
Step 01: Write the environment variables or desired capabilities to MyTest.json
Environment variables represent values that are used by your automated tests. You can use these environment variables in your MyTest.json and test code. App Functional dynamically populates environment variables at runtime by giving the values to the required environment variables.
Capabilities |
Description |
Values |
platformName |
Mobile OS platform to use |
Eg: iOS, Android, or FirefoxOS |
platformVersion |
Mobile OS version to use |
Eg: 7.1, 4.4 |
deviceName |
Kind of mobile device to use |
Eg: Galaxy S4, iPhone 11
For Android devices, run adb devices
For iOS devices, run instruments -s devices |
appPackage |
Java package of the app you want to run. |
Run adb shell dumpsys window | grep -E ‘mCurrentFocus’
Output is of the format appPackage/appActivity and fetch appPackage s the value. Open the app on a real device connected via USB(with USB debugging on) before running adb shell command. |
appActivity |
Activity name for the Android activity you want to launch from your package. |
Run adb shell dumpsys window | grep -E ‘mCurrentFocus’
Output is of the format appPackage/appActivity and fetch appActivity as the value. Open the app on a real device connected via USB(with USB debugging on) before running adb shell command. |
appiumURL |
Appium server IP address |
Eg: http://127.0.0.1:4723/wd/hub |
xcodeSigningId |
The first part of the “Common Name” associated with the developer certificate when iOS devices are used |
Eg: iPhone Developer but could be something different for you if you are automating a different iOS device. |
xcodeOrgId |
ID of the Developer Team which signed the certificate used to create the app for iOS devices |
Eg: Q9WV46GA95 It is the “Organizational Unit” value. |
bundleId |
The special iOS-internal name of our app, which is set in the same app-settings form where we selected our Team in Xcode |
Eg: io.appium.TestApp Put a value which is correct for your app. |
Please note:
- The desired capabilities – ‘xcodeSigningId’, ‘xcodeOrgId’, ‘bundleId’ must be added for iOS devices and not for Android devices.
Step 02: Add the filepath of MyTest.json to an environment variable
- Open terminal(MacOS/Linux) or command line(Windows)
- Initialize “DESIRED_CAPABILITIES_FILE_PATH” with the filepath of MyTest.json by executing the below command:
For terminal (MacOS/Linux):
export DESIRED_CAPABILITIES_FILE_PATH=<filepath of MyTest.json>
For command line (Windows):
set DESIRED_CAPABILITIES_FILE_PATH=<filepath of MyTest.json>
- Open Eclipse app from terminal (MacOS/Linux) or command line (Windows)
- Use the below method to BaseClass.java to read the filepath of MyTest.json file from an environment variable in the folder structure:
System.getenv(“DESIRED_CAPABILITIES_FILE_PATH”);
Step 03: Create a zipped test package file
mvn clean package -DskipTests=true
The target directory file path will be: java_testng_cucumber_appium_android/target/Aquamark.zip
The file with .zip extension will be created as a result. This is your test package.
Please note:
- Put username and password for GMAIL login, Facebook login as part of the script if there is any testcase that requires such credentials.
- Rectify all the build errors and missing dependencies before bundling your test package.
Step 04: Bundle to create your zipped test package file for App Functional
Now, create a test bundle for App Functional by zipping MyTest.json and .zip file created in previous two steps as MyTestPackage.zip to upload your tests to App Functional.
3. Upload the test package(scripts) to App Functional
- Sign in to App Functional console: http://demo-appfunctional.mozark.ai/
- Create or select a project. Follow the instructions on how to create or select a project.
- Upload or select a build. Follow the instructions on how to create or select a project.
- Upload the MyTestPackage.zip as test script. Follow the instructions on how to upload a test script.
Please refer to our sample build and sample scripts for Appium with Java to support TestNG Cucumber framework.
Android(Build): View on BitBucket
Next Section: Limits