-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into 1756-reactor-test-matrix
- Loading branch information
Showing
31 changed files
with
835 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,26 @@ | ||
package flank.corellium | ||
|
||
import flank.corellium.adapter.ExecuteAndroidTestPlan | ||
import flank.corellium.adapter.InstallAndroidApps | ||
import flank.corellium.adapter.InvokeAndroidDevices | ||
import flank.corellium.adapter.RequestAuthorization | ||
import flank.corellium.adapter.executeAndroidTestPlan | ||
import flank.corellium.adapter.installAndroidApps | ||
import flank.corellium.adapter.invokeAndroidDevices | ||
import flank.corellium.adapter.parseApkInfo | ||
import flank.corellium.adapter.parseApkPackageName | ||
import flank.corellium.adapter.parseApkTestCases | ||
import flank.corellium.adapter.requestAuthorization | ||
import flank.corellium.api.CorelliumApi | ||
|
||
fun corelliumApi( | ||
projectName: String | ||
) = CorelliumApi( | ||
authorize = RequestAuthorization, | ||
installAndroidApps = InstallAndroidApps( | ||
authorize = requestAuthorization, | ||
installAndroidApps = installAndroidApps( | ||
projectName = projectName | ||
), | ||
invokeAndroidDevices = InvokeAndroidDevices( | ||
invokeAndroidDevices = invokeAndroidDevices( | ||
projectName = projectName | ||
), | ||
executeTest = ExecuteAndroidTestPlan | ||
executeTest = executeAndroidTestPlan, | ||
parseTestCases = parseApkTestCases, | ||
parseTestApkInfo = parseApkInfo, | ||
parsePackageName = parseApkPackageName | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
corellium/adapter/src/main/kotlin/flank/corellium/adapter/ParseApk.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package flank.corellium.adapter | ||
|
||
import com.linkedin.dex.parser.DexParser | ||
import com.linkedin.dex.parser.TestMethod | ||
import flank.corellium.api.Apk | ||
import net.dongliu.apk.parser.ApkFile | ||
import org.xml.sax.InputSource | ||
import java.io.StringReader | ||
import javax.xml.parsers.DocumentBuilderFactory | ||
|
||
val parseApkTestCases = Apk.ParseTestCases { path -> | ||
DexParser.findTestMethods(path) | ||
.map(TestMethod::testName) | ||
} | ||
|
||
val parseApkPackageName = Apk.ParsePackageName { path -> | ||
ApkFile(path).apkMeta.packageName | ||
} | ||
|
||
val parseApkInfo = Apk.ParseInfo { path -> | ||
Apk.Info( | ||
packageName = ApkFile(path).apkMeta.packageName, | ||
testRunner = DocumentBuilderFactory.newInstance() | ||
.newDocumentBuilder() | ||
.parse(InputSource(StringReader(ApkFile(path).manifestXml))) | ||
.getElementsByTagName("instrumentation").item(0).attributes | ||
.getNamedItem("android:name").nodeValue | ||
) | ||
} |
13 changes: 0 additions & 13 deletions
13
corellium/adapter/src/main/kotlin/flank/corellium/adapter/ParseTestApk.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
corellium/adapter/src/test/kotlin/flank/corellium/adapter/ParseApkTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package flank.corellium.adapter | ||
|
||
import flank.corellium.api.Apk | ||
import org.junit.Assert.assertEquals | ||
import org.junit.Test | ||
|
||
private const val TEST_APK_PATH = "../../test_artifacts/master/apk/app-single-success-debug-androidTest.apk" | ||
|
||
class ParseApkTest { | ||
|
||
@Test | ||
fun parseTestCases() { | ||
assertEquals( | ||
listOf( | ||
"com.example.test_app.InstrumentedTest#ignoredTestWithIgnore", | ||
"com.example.test_app.InstrumentedTest#ignoredTestWithSuppress", | ||
"com.example.test_app.InstrumentedTest#test", | ||
), | ||
parseApkTestCases(TEST_APK_PATH) | ||
) | ||
} | ||
|
||
@Test | ||
fun parsePackageName() { | ||
assertEquals( | ||
"com.example.test_app.test", | ||
parseApkPackageName(TEST_APK_PATH) | ||
) | ||
} | ||
|
||
@Test | ||
fun parseInfo() { | ||
assertEquals( | ||
Apk.Info( | ||
packageName = "com.example.test_app.test", | ||
testRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
), | ||
parseApkInfo(TEST_APK_PATH) | ||
) | ||
} | ||
} |
27 changes: 0 additions & 27 deletions
27
corellium/adapter/src/test/kotlin/flank/corellium/adapter/ParseTestApkTest.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.