Improved Android UI tests with zip logs and better verbosity
This commit is contained in:
parent
defed46e45
commit
cbc3c99703
3 changed files with 65 additions and 35 deletions
|
@ -1,6 +1,5 @@
|
||||||
all:
|
all:
|
||||||
ant debug
|
ant debug install
|
||||||
ant installd
|
|
||||||
|
|
||||||
run-all-tests: all
|
run-all-tests: all
|
||||||
ant test
|
ant test
|
||||||
|
|
|
@ -1,20 +1,17 @@
|
||||||
SDK_PATH=$(shell dirname `which android`)
|
SDK_PATH=$(shell dirname `which android`)
|
||||||
SDK_PLATFORM_TOOLS_PATH=$(shell dirname `which adb`)
|
SDK_PLATFORM_TOOLS_PATH=$(shell dirname `which adb`)
|
||||||
|
|
||||||
run-basic-tests:
|
clean:
|
||||||
$(SDK_PLATFORM_TOOLS_PATH)/adb uninstall org.linphone.test
|
$(SDK_PLATFORM_TOOLS_PATH)/adb uninstall org.linphone.test
|
||||||
$(SDK_PLATFORM_TOOLS_PATH)/adb uninstall org.linphone
|
$(SDK_PLATFORM_TOOLS_PATH)/adb uninstall org.linphone
|
||||||
$(SDK_PATH)/android update test-project --path . -m ../
|
$(SDK_PATH)/android update test-project --path . -m ../
|
||||||
ant debug
|
|
||||||
ant installd
|
|
||||||
adb shell am instrument -w -e size small org.linphone.test/com.zutubi.android.junitreport.JUnitReportTestRunner
|
|
||||||
adb shell run-as org.linphone cat /data/data/org.linphone/files/junit-report.xml > linphone-junit-report.xml
|
|
||||||
|
|
||||||
run-all-tests:
|
all: clean
|
||||||
$(SDK_PLATFORM_TOOLS_PATH)/adb uninstall org.linphone.test
|
ant debug install
|
||||||
$(SDK_PLATFORM_TOOLS_PATH)/adb uninstall org.linphone
|
|
||||||
$(SDK_PATH)/android update test-project --path . -m ../
|
run-basic-tests: all
|
||||||
ant debug
|
ant test
|
||||||
ant installd
|
|
||||||
|
run-all-tests: all
|
||||||
adb shell am instrument -w -e size large org.linphone.test/com.zutubi.android.junitreport.JUnitReportTestRunner
|
adb shell am instrument -w -e size large org.linphone.test/com.zutubi.android.junitreport.JUnitReportTestRunner
|
||||||
adb shell run-as org.linphone cat /data/data/org.linphone/files/junit-report.xml > linphone-junit-report.xml
|
adb shell run-as org.linphone cat /data/data/org.linphone/files/junit-report.xml > linphone-junit-report.xml
|
||||||
|
|
|
@ -1,26 +1,60 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project name="custom_rules">
|
<project name="custom_rules">
|
||||||
<target name="test">
|
<target name="test">
|
||||||
<exec executable="adb" failonerror="true" outputproperty="tests.output">
|
<property name="output.file" value="./tests.output" />
|
||||||
<arg value="shell" />
|
<tstamp>
|
||||||
<arg value="am" />
|
<format property="archive.name"
|
||||||
<arg value="instrument" />
|
pattern="'linphonetester_'yyyyMMdd_HHmmss" />
|
||||||
<arg value="-w" />
|
</tstamp>
|
||||||
<arg value="-e" />
|
<echo>Adb log files are put in ${archive.name}.zip</echo>
|
||||||
<arg value="size" />
|
|
||||||
<arg value="small" />
|
<exec executable="adb" >
|
||||||
<arg value="org.linphone.test/android.test.InstrumentationTestRunner" />
|
<arg value="logcat" />
|
||||||
</exec>
|
<arg value="-c" />
|
||||||
<echo message="${tests.output}"/>
|
</exec>
|
||||||
<fail message="Tests failed">
|
<exec executable="./adb-log-start.sh" >
|
||||||
<condition>
|
<arg value=" ${archive.name}" />
|
||||||
<contains string="${tests.output}" substring="FAILURES" />
|
</exec>
|
||||||
</condition>
|
<exec executable="bash">
|
||||||
</fail>
|
<arg value="-c"/>
|
||||||
<fail message="Tests crashed">
|
<!-- use 'tee' command to write in file AND on stdout.
|
||||||
<condition>
|
First is used below to check if tests failed or not while second
|
||||||
<contains string="${tests.output}" substring="INSTRUMENTATION_CODE:" />
|
is used to get output in real time -->
|
||||||
</condition>
|
<arg value="adb shell am instrument -r -w -e size small org.linphone.test/com.zutubi.android.junitreport.JUnitReportTestRunner | tee ${output.file}"/>
|
||||||
</fail>
|
</exec>
|
||||||
</target>
|
<exec executable="bash" >
|
||||||
|
<arg value="-c" />
|
||||||
|
<arg value="kill `cat adb.pid`" />
|
||||||
|
</exec>
|
||||||
|
<exec executable="bash">
|
||||||
|
<arg value="-c"/>
|
||||||
|
<arg value="adb shell run-as org.linphone cat /data/data/org.linphone/files/junit-report.xml > linphone-junit-report.xml"/>
|
||||||
|
</exec>
|
||||||
|
<zip destfile="${archive.name}.zip">
|
||||||
|
<fileset dir="." includes="${archive.name}"/>
|
||||||
|
</zip>
|
||||||
|
<fail message="Tests failed">
|
||||||
|
<condition>
|
||||||
|
<resourcecontains resource="${output.file}" substring="FAILURES" />
|
||||||
|
</condition>
|
||||||
|
</fail>
|
||||||
|
<condition property="has.crashed" >
|
||||||
|
<resourcecontains resource="${output.file}" substring="Process crashed" />
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<antcall target="check-for-crash"/>
|
||||||
|
<delete file="${archive.name}"/>
|
||||||
|
<delete file="${output.file}"/>
|
||||||
|
</target>
|
||||||
|
<target name="check-for-crash" if="has.crashed">
|
||||||
|
<exec executable="bash" >
|
||||||
|
<arg value="-c" />
|
||||||
|
<arg value="tail -n 500 ${archive.name}" />
|
||||||
|
</exec>
|
||||||
|
<exec executable="bash" >
|
||||||
|
<arg value="-c" />
|
||||||
|
<arg value="cat ${archive.name} |ndk-stack -sym obj/local/`adb shell getprop ro.product.cpu.abi | tr -d '\r'`" />
|
||||||
|
</exec>
|
||||||
|
<fail message="Tests crashed"/>
|
||||||
|
</target>
|
||||||
</project>
|
</project>
|
||||||
|
|
Loading…
Reference in a new issue