Apptest.ai Integration for Azure DevOps

With just a few lines of script, you can integrate Apptest.ai Service with Azure DevOps Pipeline to let our Testbot explore your apps and provide detailed reports.

To use the Apptest.ai service within Azure DevOps Pipeline, follow these two steps:

  1. Register the Apptest.ai Access Key.
  2. Add Apptest.ai to your build script (azure-pipelines.yml).

Step 1: Adding the Apptest.ai Access Key to the Build Environment

  • Copy the access key from the Profile Page in Apptest.ai.
  • Register the APPTEST_AI_ACCESS_KEY variable in the Variable tab within Azure Pipeline settings.
  • Once registered, click the lock icon to set the variable as secret, which prevents others from viewing it.

The format for APPTEST_AI_ACCESS_KEY should be set as follows:
Apptest.ai ID:Apptest.ai Access Key.

For example: jean@apptest.ai:ab8f3e321d631c84c9b1113.

Step 2: Calling the Script from azure-pipelines.yml

Add a script to execute the CI Tool Integration Script provided by Apptest.ai as follows. In this script, you need to pass the environment variable created earlier to the env section. Azure DevOps Pipeline requires explicit mapping for secret variables.

At least two arguments—binary_path and project_id—are required to invoke the service.

  • binary_path: Path to the binary you want to test (e.g., .apk files for Android, .ipa files for iOS).
  • project_id: Project ID from Apptest.ai, which contains the settings for test time, device list, etc.

The project ID can be found on the Project Information page of Apptest.ai.

If you don’t want to download the CI integration script every time, you can include the ci_addon repository from Apptest.ai in your project repository in advance.

If the project_id is also registered as a Pipeline variable, you can simplify your build YML file as follows:

After committing the build script, Azure DevOps will initiate the build process. When the script reaches Apptest.ai, the test will be executed and results printed on the console.

Important Considerations

Currently, the Azure DevOps Pipeline has some errors while handling the output to the console.

  • Logs that use ASCII color codes cannot be displayed during the build, but only after the build is finished.
  • Additionally, there is an error that ignores the alignment setting through the printf command in bash, causing the alignment of the result column to break.

However, given the current evolution of Azure DevOps services, we hope these issues will be resolved soon.

The test results are stored in the test-results/apptest.ai/result.html with a detailed HTML report and an XML document in JUnit Test result format in test-results/apptestai/result.xml. You can save this file using the various deploy features provided by Azure DevOps. Below is an example of publishing the results as an artifact and test result in Azure.

If you want to change the location of the folder where the test results are stored, declare and pass the test_result_pathenvironment variable.

If you want to execute the next build script before finishing the test, declare the waiting_for_test_results environment variable and set its value to “false”.

Finally, let me show you the complete azure-pipelines.yml example. The first case is for Android.

Complete azure-pipelines.yml Example

Android Case

Below is an example for an Android project:

iOS Case

Next is an example for iOS:

As you can see, the difference between Android and iOS cases lies in the actual building and packaging of the binary, but the process for calling the Apptest.ai testbot and saving the result is the same.

Final Notes

The test results, including a detailed HTML report (result.html) and an XML document in JUnit Test result format (result.xml), are stored in the test-results/apptestai/ directory. You can save these files using Azure DevOps’ deploy features, as shown in the examples above.

Leave a Reply

Your email address will not be published. Required fields are marked *