Skip to content
This repository was archived by the owner on Dec 7, 2019. It is now read-only.

Commit c4e7668

Browse files
tagantroyyunikkk
authored andcommitted
[WIP] "Orchestrator like" execution mode (#138)
"Orchestrator like" execution mode part 1.
1 parent 9019ce4 commit c4e7668

File tree

6 files changed

+23
-2
lines changed

6 files changed

+23
-2
lines changed

composer/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ dependencies {
1616
compile libraries.apacheCommonsIo
1717
compile libraries.apacheCommonsLang
1818
compile libraries.gson
19+
compile libraries.dexParser
1920
}
2021

2122
dependencies {

composer/src/main/kotlin/com/gojuno/composer/Apk.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.gojuno.composer
33
import com.gojuno.commander.android.aapt
44
import com.gojuno.commander.os.Notification
55
import com.gojuno.commander.os.process
6+
import com.linkedin.dex.parser.DexParser
67

78
sealed class TestPackage {
89
data class Valid(val value: String) : TestPackage()
@@ -61,4 +62,7 @@ fun parseTestRunner(testApkPath: String): TestRunner =
6162
}
6263
.toSingle()
6364
.toBlocking()
64-
.value()
65+
.value()
66+
67+
fun parseTests(testApkPath: String): List<TestMethod> =
68+
DexParser.findTestMethods(testApkPath).map { TestMethod(it.testName, it.annotationNames) }

composer/src/main/kotlin/com/gojuno/composer/Main.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ private fun List<String>.pairArguments(): List<Pair<String, String>> =
198198
}
199199
}
200200

201+
private fun buildSingleTestArguments(testMethod : String) : List<Pair<String,String>> =
202+
listOf("class" to testMethod)
203+
201204
private fun buildShardArguments(shardingOn: Boolean, shardIndex: Int, devices: Int): List<Pair<String, String>> = when {
202205
shardingOn && devices > 1 -> listOf(
203206
"numShards" to "$devices",
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package com.gojuno.composer
2+
3+
data class TestMethod(val testName: String, val annotationNames: List<String>)

composer/src/test/kotlin/com/gojuno/composer/ApkSpec.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,13 @@ class ApkSpec : Spek({
1818
it("parses test package correctly") {
1919
assertThat(parseTestPackage(testApkPath)).isEqualTo(TestPackage.Valid("test.test.myapplication.test"))
2020
}
21+
22+
it("parses tests list correctly") {
23+
assertThat(parseTests(testApkPath)).isEqualTo(listOf(
24+
TestMethod("test.test.myapplication.ExampleInstrumentedTest#useAppContext",
25+
listOf("dalvik.annotation.Throws", "org.junit.Test", "org.junit.runner.RunWith")
26+
)
27+
))
28+
}
2129
}
22-
})
30+
})

dependencies.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ ext.versions = [
77
apacheCommonsIo : '2.5',
88
apacheCommonsLang: '3.5',
99
gson : '2.8.0',
10+
dexParser : '1.1.0',
1011

1112
junit : '4.12',
1213
junitPlatform : '1.0.0-M4',
@@ -26,6 +27,7 @@ ext.libraries = [
2627
apacheCommonsIo : "commons-io:commons-io:$versions.apacheCommonsIo",
2728
apacheCommonsLang : "org.apache.commons:commons-lang3:$versions.apacheCommonsLang",
2829
gson : "com.google.code.gson:gson:$versions.gson",
30+
dexParser : "com.linkedin.dextestparser:parser:$versions.dexParser",
2931

3032
junit : "junit:junit:$versions.junit",
3133
spek : "org.jetbrains.spek:spek-api:$versions.spek",

0 commit comments

Comments
 (0)