qt5base-lts/mkspecs/features/qmltestcase.prf
BogDan Vatra a5e03f59f4 Say hello to androidtestrunner
androidtestrunner is a tool needed to run qt tests on Android.
Now you can run tests as simple as you run them on Linux, macOS,
Windows.
"$ make check" it's all you need to run tests on the default android
device.

ANDROID_DEVICE_SERIAL env variable can be used to use a specific android
serial.

Use cases:
$ make -j1 check
-j1 is needed to make sure we don't run multiple tests in parallel.

$ ANDROID_DEVICE_SERIAL="emulator-5554" make check
Run the test on "emulator-5554"

$ make TESTARGS="-- -xml" check
Switch to xml output. All params after -- are passed to test
application.

$ make TESTARGS="-- -o out.xml,xml -o out.txt,txt -o -,tap -vs" check
Create two files out.xml and out.txt in the current folder and print
"tap" format to stdout and enable logging of every signal emission.

[ChangeLog][Android] Make it easy to run Qt tests on Android.
"$ make check" is all it's needed to run a test on an Android device.

Change-Id: I1a7f64b62608f7367b5a6aabf5d6c6e7e50242e6
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2019-06-06 15:25:07 +03:00

26 lines
840 B
Plaintext

!isEmpty(SOURCES) {
QT += qml qmltest
load(testcase)
!android {
contains(TEMPLATE, vc.*): DEFINES += QUICK_TEST_SOURCE_DIR=\"$$_PRO_FILE_PWD_\"
else: DEFINES += QUICK_TEST_SOURCE_DIR=$$shell_quote(\"$$_PRO_FILE_PWD_\")
} else {
!isEmpty(RESOURCES): warning("The RESOURCES qmake variable is empty, the test will probably fail to run")
DEFINES += QUICK_TEST_SOURCE_DIR=\":/\"
}
} else {
# Allow a project to run tests without a CPP stub
TEMPLATE = aux
QMAKE_EXTRA_TARGETS += check
qtPrepareTool(QMAKE_QMLTESTRUNNER, qmltestrunner)
check.commands = $$QMAKE_QMLTESTRUNNER
}
# If the .pro file specified an IMPORTPATH, then add that to
# the command-line when the test is run.
!isEmpty(IMPORTPATH) {
for(import, IMPORTPATH): check.commands += -import \"$$import\"
}