Commit 80ecf0a6 authored by Aneta Steimarova's avatar Aneta Steimarova

#691 Running tests on more devices one by one: saving outputs from different...

#691 Running tests on more devices one by one: saving outputs from different devices to different folders
parent 9c8feee8
......@@ -297,13 +297,12 @@ def runTest(String iTestName, String device) {
println "[iTest-" + device + "] Test " + iTestName + " timed out."
}
def androidITestBundle(String device){
String androidITestBundle(String device){
int testsCount = 0;
int successfulTestsCount = 0;
def tablexiaApk = project.tablexiaAppName + "-iTest-" + "$tablexiaVersionName" + ".apk"
def apkFolder = "${project(':android').projectDir}/build/outputs/apk/"
//TODO make different folders for different devices
def sdCardResults = "/sdcard/iTest_results"
println "[iTest-" + device + "] INSTALLING " + tablexiaApk + " into connected Android device"
......@@ -319,11 +318,13 @@ def androidITestBundle(String device){
println "[iTest-" + device + "] INSTALLING Tablexia COMPLETED"
println "[iTest-" + device + "] CREATING NEW iTest OUTPUT DIRECTORY"
def iTestOutputFile = new File(apkFolder + "iTest_results/")
def iTestOutputFolder = "iTest_results-" + device
def iTestOutputFile = new File(apkFolder + iTestOutputFolder)
if (iTestOutputFile.exists()) {
println "[iTest-" + device + "] REMOVING OLD iTest OUTPUT DIRECTORY"
iTestOutputFile.deleteDir()
}
project.file(apkFolder + iTestOutputFolder).mkdirs()
new File("${project(':itest').projectDir}/iTestBundle.txt").eachLine { iTestName ->
exec {
......@@ -334,16 +335,24 @@ def androidITestBundle(String device){
runTest(iTestName, device)
println "[iTest-" + device + "] TEST: " + iTestName + " FINISHED"
exec {
commandLine "$adb", '-s', device, 'pull', sdCardResults, apkFolder
commandLine "$adb", '-s', device, 'pull', sdCardResults, apkFolder + iTestOutputFolder+ "/"
}
println "[iTest-" + device + "] LOG FILES WERE MOVED INTO " + iTestOutputFile.toString()
}
file("$iTestOutputFile").eachFile { logFile ->
file("$iTestOutputFile" + "/iTest_results").eachFile { logFile ->
if(logFile.toString().contains("OK")) successfulTestsCount++;
}
if (testsCount != successfulTestsCount) throw new GradleException("Failed to complete all iTests! Check iTest log files in: " + iTestOutputFile.toString())
if (testsCount != successfulTestsCount){
def failLogs = testsCount - successfulTestsCount
println "[iTest-" + device + "] " + failLogs + "OF TESTS ON THIS DEVICE FINISHED WITH STATUS FAIL!"
return "[iTest-" + device + "] Failed to complete all iTests! Check iTest log files in: " + iTestOutputFile.toString() + "/iTest_results/\n"
}
else{
println "[iTest-" + device + "] ALL TESTS ON THIS DEVICE FINISHED WITH STATUS OK!"
return ""
}
}
task runAndroidITestBundle (dependsOn:'assembleITest'){
......@@ -355,6 +364,7 @@ task runAndroidITestBundle (dependsOn:'assembleITest'){
standardOutput = adbOut
}
def connectedDevices = 0
def exceptions = ""
adbOut.toString().eachLine { line ->
if (!line.contains("List") && line.contains("device")) {
connectedDevices++;
......@@ -364,9 +374,10 @@ task runAndroidITestBundle (dependsOn:'assembleITest'){
}
def device = line.substring(0, i)
println "Connected device: " + device
androidITestBundle(device)
exceptions += androidITestBundle(device)
}
}
if(connectedDevices<1) throw new GradleException("NO CONNECTED DEVICE WAS FOUND!")
if(exceptions!="") throw new GradleException(exceptions)
}
}
\ No newline at end of file
NewUserScenario
TestScenarioSpecial
\ No newline at end of file
TestScenarioSpecial
OfficeTestScenario
\ No newline at end of file
......@@ -103,7 +103,7 @@ public abstract class AbstractTestScenario implements Runnable {
private static final float DEBUG_ACTOR_SQUARE_SIZE = 50f;
protected static final int DEFAULT_TASK_TIMEOUT = 60;
protected static final int TASK_DOWNLOAD_ASSETS_TIMEOUT = 300;
protected static final int TASK_DOWNLOAD_ASSETS_TIMEOUT = 400;
private static final String DATE_FORMAT_FOR_LOGFILE_NAME = "yyyyMMddHHmmSS";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment