Table of Contents

Leveraging XCUITest for Apple Store Multilanguage Screenshots

XCUITest revolutionizes iOS app testing, providing developers with a powerful toolset to ensure impeccable performance and user experience. Through streamlined automation and precise validation, XCUITest empowers developers to confidently deliver high-quality apps that exceed user expectations, all while accelerating the development process.

Introduction

XCUITest is used to write User Interface (UI) test cases to validate the UI functionality but only some people know that it can be used to capture screenshots that we upload on the apple store while publishing an application.

Initially, it might not sound like a big deal as capturing a screenshot manually takes only a few seconds, using a simulator or an iOS device. Consider a scenario where your mobile application supports 25 different languages. The requirement is to upload screenshots to the apple store for all languages. If we calculate the total number of screenshots to be uploaded, the count comes to 625. Now, it sounds interesting as manually taking 625 screenshots is a time-consuming process. This is where XCUITest comes to rescue us and help us automate the process of taking screenshots. Let us take a deep dive into how it can be achieved.

A Quick Glance Over the Process

We need to follow the steps below:

  1. Write a XCUITest that can take a screenshot of the desired screen. It is recommended to write separate test cases for each screen that we want to capture.
  2. Create a new test plan and add configuration for each language.
  3. Run test cases and export all screenshots for test logs.

Writing a UI Test

An application has multiple screens and depending on the screen we want to take a screenshot of a test case is written. The image below shows a sample code to capture a screenshot of the home screen on the launch of the application. The test case should be written in a way that all the necessary data and the UI component are displayed and then we can capture a screenshot.

 

Writing a UI Test

 

Setting up a Test Plan

To create additional test plans, do the following:

  1. Choose Product > Test Plan > New Test Plan
  2. Enter a name for the new test plan.
  3. Choose a location to save the test plan.
  4. Click Create.

Configuring a Test Plan

Select the test plan and then select the Configuration tab, where, by default, we have one shared setting configuration set. This shared setting is a Global setting for the new configuration created. The next step is to create a new configuration by selecting “+”. We need to create a new configuration for each language that we support in the application. Please refer the image below:

 

Configuring a Test Plan

Note: For the German configuration, we have selected the application language as German. Similarly, for each configuration, we have a different application language, and we can change other parameters depending upon our requirement.

Add a Test Plan to a Scheme

You can associate a test plan with more than one scheme, to get the same test cases and methods included with the same configurations in multiple schemes. To add an existing test plan to a scheme, do the following:

  1. Choose Product > Test Plan > Manage Test Plans
  2. Click the Add button below the list of the test plans.
  3. Choose Add existing Test Plan.
  4. Select the test plan you want to add to the scheme.

Run Test Cases to See the Magic 

Once everything is set up, it’s time to run the test cases. All test cases are run for each configuration. In our cases, we have four configurations i.e., English, French, German, and Korean. In the image below, we can see that our test ran four times in the respective language and captured a screenshot of each language.

 

 

Conclusion

In conclusion, XCUITest emerges as a formidable ally of the iOS developers in their pursuit of automating screenshot capture. Its robust capabilities not only streamline the tedious process of manually capturing screenshots but also offer a comprehensive solution to ensure visual consistency and accuracy across diverse screen resolutions and device types. By harnessing the power of XCUITest, developers can significantly enhance efficiency, accelerate release cycles, and elevate the overall quality of their iOS applications. As automation continues to redefine the landscape of software development, XCUITest stands at the forefront, empowering developers to navigate the complexities of app testing with confidence and precision, ultimately delivering exceptional user experiences in the ever-evolving world of iOS development.

Picture of Dhaval Shah

Dhaval Shah

Mobile engineer well-versed in developing applications using Objective-C, Swift, and SwiftUI. I have a strong background in various architectures like MVVM, MVC, Coordinators, VIPER and more, and have extensive experience in developing SDK/frameworks.

Explore More

Talk to an Expert

Subscribe
to our Newsletter
Stay in the loop! Sign up for our newsletter & stay updated with the latest trends in technology and innovation.

Start a conversation today

Schedule a 30-minute consultation with our Battery Management Solutions Expert

Start a conversation today

Schedule a 30-minute consultation with our Industrial & Energy Solutions Experts

Start a conversation today

Schedule a 30-minute consultation with our Automotive Industry Experts

Start a conversation today

Schedule a 30-minute consultation with our experts

Please Fill Below Details and Get Sample Report

Reference Designs

Our Work

Innovate

Transform.

Scale

Partnerships

Device Partnerships
Digital Partnerships
Quality Partnerships
Silicon Partnerships

Company

Products & IPs