AuroraTests: A Versatile Framework for HMI Testing

When building a complex HMI that supports and operates across multiple platforms and variants, testing is extremely important. That’s where AuroraTests, the Black Box automated testing framework, stands out. With its flexible and scalable capabilities, AuroraTests simplifies the process of testing multiple variants of the same scenario while maintaining efficiency and consistency across platforms.

In our previous post, How to Create Your First Automated Test with AuroraTests, we walked through the basics of setting up your first automated test.

Now, we’ll explore how AuroraTests can seamlessly execute the same test with different devices, themes, and languages by simply changing the resource files used during test execution.

1. Test Scenario and Test Case

Our featured test scenario involves locating the phone icon on the home screen and tapping it to access the phone menu. We will use a Pixel phone emulator along with Android Automotive from AOSP, as the HMI System Under Test (SUT), showcasing the adaptability of AuroraTests.

Test Case

Given
(precondition)

When
(action/input)

Then
(result/output)

Locate and tap the phone icon on the home screen.

  1. HMI is running.
  2. Home screen is displayed.

Phone icon is shown.

Phone app is opened after tapping on the phone button.

2. Writing the Test with AuroraTests

Let’s dive into the AuroraTests framework and see how we can create a test to automate this task.

This test demonstrates how AuroraTests can leverage a resource file to locate and interact with UI elements. The same script is used for different devices by providing different resource files as input.

Here’s how you can write a test using the AuroraTests framework:

				
					from aurora_tests.pytest.fixtures import display, touches, resources

def test_phone_app(display, touches, resources):
    # Find the phone icon on the home screen
    phone_icon = display.grab().find_image(resources["PHONE_ICON"])
    assert phone_icon, "Phone icon not found on the home screen"

    # Tap on the phone icon to open the phone app
    touches.tap(phone_icon.center())

    # Simple assertion to ensure the test completes
    assert True

				
			

3. Leveraging Resource Files for Cross-Device Testing

AuroraTests utilizes the widely used JSON format in its resource files. By passing different resource files when running a test, it ensures that tests can adapt to different screen layouts and resolutions without modifying the test script itself.

Example resource files for different devices:

Pixel Phone Resource File:

				
					{
    "PHONE_ICON": "./src/common/res_pixel_1080_2220/phone_icon.png",
}

				
			

Corresponds to:

Android Automotive Resource File:

				
					{
    "PHONE_ICON": "./src/common/res_automotive_1920_1080/phone_icon.png",
}

				
			

Corresponds to:

4. Visual Demonstration: Running the Test

Below are step-by-step screenshots demonstrating the test execution process.

1. Pixel Phone Home Screen Before Test:

Shows the initial state of the Pixel phone’s home screen before running the test.

Screenshot 1: Pixel Phone Home Screen Before Test

2. Android Automotive Home Screen Before Test:

Shows the Android Automotive’s home screen before running the test.

Screenshot 2: Android Automotive Home Screen Before Test

3. Console Running the Test for Pixel Phone:

This example shows the console running the test for the Pixel phone emulator with the corresponding resource file as an input argument. The output shows that the test was successfully completed.

Screenshot 3: Console Running the Test for Pixel Phone

4. Console Running the Test for Android Automotive:

Now the same test is run for Android Automotive emulator, by only using different resource file. It shows that the test is executed and passed as expected.

Screenshot 4: Console Running the Test for Android Automotive

5. Pixel Phone Menu After Test Execution:

The final screenshot displays the Pixel phone menu after the test has run, showing that the phone app has been opened

Screenshot 5: Pixel Phone Menu After Test Execution

6. Android Automotive Menu After Test Execution:

The final screenshot displays the Android Automotive phone menu after the test has run, also showing that the phone app has been opened.

Screenshot 6: Android Automotive Menu After Test Execution

5. Optimizing HMI Testing with AuroraTests

This post demonstrated the flexibility of AuroraTests by running the same test across different devices, showcasing its power in multi-variant testing. By simply using different resource files, we are able to run the same test script for different HMI variants (different platforms, day/night themes, different localisations, etc.) without test modifications.

Whether deploying on a Pixel phone or Android Automotive, AuroraTests ensures consistent test execution with various configurations, enabling businesses to enhance their HMI testing and ensure quality across all platforms. This streamlined approach not only optimizes testing procedures but also reduces development time and costs.

Discover the Benefits of AuroraTests

Take your testing process to the next level by leveraging AuroraTests’ flexible framework. Contact us to learn more about how AuroraTests can integrate seamlessly into your HMI development workflow or to schedule a demo of this powerful testing framework.