0

I am new to test automation, especially new to mobile phone test automation. I want to know how can I write some script to run test automation for Android system. I know a tool named Appium which can test an app on Android, but that's not what I need.

I want to test several apps together, for example, click on camera app, take some photo, then close camera app, open photo app, and check if there is a photo in there, or dial a phone call, then record voice and check if the voice is recorded. I need to cross-app test, not just one app.

Do you know any tool can help me to finish this kind of job? Thanks!

1
  • 1
    What is the reason you need to automate testing across multiple apps? The reason I ask is that each time you have to cross a major boundary, such as moving from one app to another, you increase the risk of external factors impacting your tests. As a general rule, unless you have no other choice you should be looking at minimizing the amount of interaction with UIs that your automation needs to do.
    – Kate Paulk
    Mar 22 at 16:25

1 Answer 1

1

Here's a possible suggestion to help you resolve your query,

First, you need to understand that Appium is a popular open-source library used for mobile test automation, but it is mostly used for testing individual apps rather than cross-app testing. However, Appium can still be used to accomplish cross-app testing on Android by utilizing its ability to automate user actions on the mobile device.

To perform cross-app testing, you can use Appium with a few additional steps as follows:

1 Identify the apps to be tested: Identify the apps that need to be tested and ensure they are installed on the Android device.

2 Create a test script: Create a test script using Appium's client libraries for the programming language of your choice. In this script, you can automate user actions such as launching an app, taking a photo, and navigating to another app.

Here's an example of a test script using Python client library:

from appium import webdriver
from time import sleep

desired_caps = {
  "platformName": "Android",
  "deviceName": "Android Emulator",
  "appPackage": "com.android.camera",
  "appActivity": "com.android.camera.Camera"
}

driver = webdriver.Remote("http://localhost:4723/wd/hub", desired_caps)

# Take a photo
driver.find_element_by_id("com.android.camera:id/shutter_button").click()
sleep(5)
driver.find_element_by_id("com.android.camera:id/done_button").click()

# Open photo app and check if the photo is there
driver.start_activity("com.android.gallery3d", "com.android.gallery3d.app.GalleryActivity")
sleep(2)
assert driver.find_element_by_id("com.android.gallery3d:id/action_bar_title").text == "Album"

driver.find_element_by_id("com.android.gallery3d:id/album_name").click()
sleep(2)
assert driver.find_element_by_id("com.android.gallery3d:id/gallery_photo_count_textview").text == "1 photo"

driver.quit()

In this example, the script launches the camera app, takes a photo, closes the camera app, opens the photo app, navigates to the album containing the photo, and verifies that the photo is there.

3 Set up Appium: Set up Appium on your machine and connect it to the Android device. You can refer to the Appium documentation for more information on setting up Appium.

4 Run the test script: Run the test script using the Appium server. The script will execute user actions on the Android device and verify that the expected results are achieved.

By using Appium and creating a test script that automates user actions across multiple apps, you can perform cross-app testing on Android. It may require additional setup and configuration, but it can be a valuable testing strategy for mobile apps that interact with other apps on the device.

I hope this solution helps you in your mobile testing journey. If you have any further questions or require more information, feel free to ask or refer to the references below.

References:

Not the answer you're looking for? Browse other questions tagged or ask your own question.