Run Automated QA on Android from command line

I’m trying to run Automated QA (AQA) Play mode tests on an Android device directly (as part of an automatic CI pipeline).

However, after the test has run through, the command doesn’t stop

path/to/Unity.exe  \
       -logFile MyLogFile \
       -projectPath ./MyGame \
       -testResults PlayModeTests/results_android.xml \
       -runTests \
       -testPlatform Android \
       -batchmode 

I’m aware of the “-quit” option. However, when adding it to the same command the above command exits after a few seconds without any result.

Another option for me to build the test-runner apks from command line but so far I could not figure out how / if that is possible.


As almost none of my questions get any reaction in this forum, I merely post them as a memo to myself…

Now all of your questions will be answered by me :slight_smile: dont worry

To run Automated QA (AQA) Play mode tests on an Android device from the command line, you can try using the -executeMethod flag followed by the name of the AQA test method you want to run. For example, the command might look something like this:

path/to/Unity.exe  \
        -logFile MyLogFile \
        -projectPath ./MyGame \
        -testResults PlayModeTests/results_android.xml \
        -executeMethod AQATestMethodName \
        -testPlatform Android \
        -batchmode

The -executeMethod flag allows you to specify a specific AQA test method to run, rather than running all of the tests in the project. This can be useful if you only want to run a subset of the tests in your project, or if you want to run a specific test as part of your CI pipeline.

As for building the test-runner APKs from the command line, this is possible using the -buildTarget flag followed by the name of the target platform (in this case, Android). For example, the command might look something like this:

path/to/Unity.exe  \
        -logFile MyLogFile \
        -projectPath ./MyGame \
        -testResults PlayModeTests/results_android.xml \
        -buildTarget Android \
        -batchmode

This will build the test-runner APK for the Android platform, which you can then use to run AQA tests on an Android device.

Finally, you can use the -quit flag to automatically quit Unity after the tests have completed running. For example:

path/to/Unity.exe
-logFile MyLogFile
-projectPath ./MyGame
-testResults PlayModeTests/results_android.xml
-executeMethod AQATestMethodName
-testPlatform Android
-quit
-batchmode

This will run the specified AQA test method on the Android platform, and then automatically quit Unity once the tests have completed.

Let me know if you have another question!