Skip to content

Instantly share code, notes, and snippets.

@SKART1
Created January 10, 2017 10:41
Show Gist options
  • Save SKART1/794ffda926002200c05ec2a4b5e67391 to your computer and use it in GitHub Desktop.
Save SKART1/794ffda926002200c05ec2a4b5e67391 to your computer and use it in GitHub Desktop.
task testOnPlantation(dependsOn: [ 'assembleDebug', 'assembleAndroidTest', 'performTesting']) {
performTesting {
def shouldLogToWatson = false;// Boolean.parseBoolean((String) System.env.shouldLogToWatson)
def buildType = (String) System.env.buildType
def buildBranch = (String) System.env.buildBranch
def buildVersion = android.defaultConfig.versionName
serverAddress = 'http://172.18.89.85:10800'
testAuthorFilterValue = parseCsv((String) System.env.testAuthorFilterValue)
testNameFilterValue = parseCsv((String) System.env.testNameFilterValue)
pollInterval = 2_000L
// //Instrumentaion apks
// def butlerFullPath = intrumentationApksPath + File.separator + testButlerFullName + "-" + testButlerAllVersion + ".apk"
// def butlerReducedPath = intrumentationApksPath + File.separator + testButlerReducedName + "-" + testButlerAllVersion + ".apk"
//
// instrumentApkListIfEmulator = [new File(butlerFullPath)]
// instrumentApkListIfHardwareDevice = [new File(butlerReducedPath)]
////Data
appApkFile = new File('app/build/outputs/apk/app-development-debug.apk')
testApkFile = new File('app/build/outputs/apk/app-development-debug-androidTest.apk')
testListFile = new File(fileWithTestsPath)
//Parameters
testInstrumentationRunner = android.defaultConfig.testInstrumentationRunner
testInstrumentationTimeout = new TimeDuration(0, 4, 0, 0).toMilliseconds()
testExternalTimeout = new TimeDuration(0, 8, 0, 0).toMilliseconds()
outputPath = buildDir.absolutePath
runName = System.env.RUN_NAME;
runMeta = ["Started at" : new SimpleDateFormat("HH:mm:ss dd.MM.yyyy", Locale.US).format(new Date()),
"From machine": InetAddress.getLocalHost().getHostName()]
clearApplicationDataBefore = Boolean.parseBoolean((String) System.env.clearApplicationDataBefore)
clearApplicationDataAfter = Boolean.parseBoolean((String) System.env.clearApplicationDataAfter)
//BeforeRound
beforeRoundPlugins = new ArrayList<PluginBean>()
// if (shouldLogToWatson) {
// Map<String, String> watsonStartBeforeRoundPluginParameters = new WatsonStartBeforeRoundPlugin.Builder()
// .sendToWatson("https", "watson.at.odkl.ru", 443)
// .withProperties(buildType, buildBranch, buildVersion)
// .build();
// beforeRoundPlugins.add(new PluginBean(WatsonStartBeforeRoundPlugin.class.canonicalName, watsonStartBeforeRoundPluginParameters));
// }
//AfterRound
afterRoundPlugins = new ArrayList<PluginBean>()
afterRoundPlugins.add(new PluginBean(OkReportAfterRoundPlugin.class.canonicalName, Collections.emptyMap()))
// if (shouldLogToWatson) {
// Map<String, String> parameters = new WatsonFinishAfterRoundPlugin.Builder()
// .sendToWatson("https", "watson.at.odkl.ru", 443)
// .build();
// afterRoundPlugins.add(new PluginBean(WatsonFinishAfterRoundPlugin.class.canonicalName, parameters));
// }
//AfterLaunch
afterLaunchPlugins = new ArrayList<PluginBean>()
afterLaunchPlugins.add(new PluginBean(AfterLaunchStatusPlugin.class.canonicalName, Collections.emptyMap()));
Map<String, String> artifactPublishingAfterLaunchPluginParameters = new ArtifactPublishingAfterLaunchPlugin.Builder()
.withHost("https://testutils.at.odkl.ru/")
.forProject("vesna-android-test")
.build();
afterLaunchPlugins.add(new PluginBean(ArtifactPublishingAfterLaunchPlugin.class.canonicalName, artifactPublishingAfterLaunchPluginParameters));
// if (shouldLogToWatson) {
// Map<String, String> watsonAfterLaunchReporterPluginParameters = new WatsonAfterLaunchReporterPlugin.Builder()
// .sendToWatson("https", "watson.at.odkl.ru", 443)
// .markers("/marker")
// .logs("/uploadLogs", "log_suffix.txt")
// .build();
// afterLaunchPlugins.add(new PluginBean(WatsonAfterLaunchReporterPlugin.class.canonicalName, watsonAfterLaunchReporterPluginParameters));
// }
responseHandler = {
println "END"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment