diff --git a/.idea/runConfigurations/android_test_gradle_plugin.xml b/.idea/runConfigurations/android_test_gradle_plugin.xml new file mode 100644 index 000000000..553f43303 --- /dev/null +++ b/.idea/runConfigurations/android_test_gradle_plugin.xml @@ -0,0 +1,27 @@ + + + + + + + true + true + false + false + + + + \ No newline at end of file diff --git a/core/src/main/kotlin/com/malinskiy/marathon/report/bill/BillingReporter.kt b/core/src/main/kotlin/com/malinskiy/marathon/report/bill/BillingReporter.kt index 46481f8aa..d63220972 100644 --- a/core/src/main/kotlin/com/malinskiy/marathon/report/bill/BillingReporter.kt +++ b/core/src/main/kotlin/com/malinskiy/marathon/report/bill/BillingReporter.kt @@ -61,7 +61,7 @@ internal class BillingReporter( } usageTracker.trackEvent(Event.Devices(bills.size)) - val result = executionReport.summary.pools.map { it.failed.size == 0 }.reduce { acc, b -> acc && b } + val result = executionReport.summary.pools.map { it.failed.isEmpty() }.reduceOrNull { acc, b -> acc && b } ?: true val flakiness = executionReport.summary.pools.sumOf { it.rawDurationMillis - it.durationMillis / 1000 } val durationSeconds = ((Instant.now().toEpochMilli() - defaultStart.toEpochMilli()) / 1000) usageTracker.trackEvent(Event.Executed(seconds = bills.sumOf { it.duration } / 1000, diff --git a/sample/android-app/app/build.gradle.kts b/sample/android-app/app/build.gradle.kts index 04b9993ff..1bf275a1f 100644 --- a/sample/android-app/app/build.gradle.kts +++ b/sample/android-app/app/build.gradle.kts @@ -4,7 +4,7 @@ import com.malinskiy.marathon.config.vendor.android.TestParserConfiguration plugins { id("com.android.application") id("kotlin-android") - id("com.malinskiy.marathon") version "0.8.2-SNAPSHOT" + id("com.malinskiy.marathon") version "0.8.5-SNAPSHOT" } android { diff --git a/sample/android-app/settings.gradle.kts b/sample/android-app/settings.gradle.kts index 128c9631a..24e0a3701 100644 --- a/sample/android-app/settings.gradle.kts +++ b/sample/android-app/settings.gradle.kts @@ -20,3 +20,4 @@ pluginManagement { rootProject.name = "android-app" rootProject.buildFileName = "build.gradle.kts" include("app") +include("ui-tests") diff --git a/sample/android-app/ui-tests/build.gradle.kts b/sample/android-app/ui-tests/build.gradle.kts new file mode 100644 index 000000000..3b91a8279 --- /dev/null +++ b/sample/android-app/ui-tests/build.gradle.kts @@ -0,0 +1,43 @@ +import com.malinskiy.marathon.config.vendor.android.TestParserConfiguration + +plugins { + id("com.android.test") + id("kotlin-android") + id("com.malinskiy.marathon") version "0.8.5-SNAPSHOT" +} + +android { + buildToolsVersion = "34.0.0" + compileSdk = 33 + + namespace = "com.example.ui_tests" + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = "1.8" + } + + defaultConfig { + minSdk = 21 + targetSdk = 33 + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + targetProjectPath(":app") +} + +dependencies { + implementation(TestLibraries.testRunner) + implementation(TestLibraries.extJunit) + implementation(TestLibraries.espressoCore) +} + +marathon { + testParserConfiguration = TestParserConfiguration.RemoteTestParserConfiguration() + uncompletedTestRetryQuota = 3 +} diff --git a/sample/android-test/ui_tests/src/androidTest/java/com/example/ui_tests/ExampleInstrumentedTest.kt b/sample/android-app/ui-tests/src/main/kotlin/com/example/ui_tests/ExampleInstrumentedTest.kt similarity index 78% rename from sample/android-test/ui_tests/src/androidTest/java/com/example/ui_tests/ExampleInstrumentedTest.kt rename to sample/android-app/ui-tests/src/main/kotlin/com/example/ui_tests/ExampleInstrumentedTest.kt index 9983a2611..ccd2b0376 100644 --- a/sample/android-test/ui_tests/src/androidTest/java/com/example/ui_tests/ExampleInstrumentedTest.kt +++ b/sample/android-app/ui-tests/src/main/kotlin/com/example/ui_tests/ExampleInstrumentedTest.kt @@ -3,7 +3,7 @@ package com.example.ui_tests import androidx.test.ext.junit.rules.ActivityScenarioRule import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 -import com.example.app_impl.AppActivity +import com.example.MainActivity import org.junit.Test import org.junit.runner.RunWith @@ -20,12 +20,12 @@ import org.junit.Rule class ExampleInstrumentedTest { @get:Rule - val androidScenarioRule = ActivityScenarioRule(AppActivity::class.java) + val androidScenarioRule = ActivityScenarioRule(MainActivity::class.java) @Test fun useAppContext() { // Context of the app under test. val appContext = InstrumentationRegistry.getInstrumentation().targetContext - assertEquals("com.example.ui_tests.test", appContext.packageName) + assertEquals("com.example", appContext.packageName) } -} \ No newline at end of file +} diff --git a/sample/android-library/library/build.gradle.kts b/sample/android-library/library/build.gradle.kts index 85ae4deca..06e9b7db6 100644 --- a/sample/android-library/library/build.gradle.kts +++ b/sample/android-library/library/build.gradle.kts @@ -1,7 +1,7 @@ plugins { id("com.android.library") id("kotlin-android") - id("com.malinskiy.marathon") version "0.8.2-SNAPSHOT" + id("com.malinskiy.marathon") version "0.8.5-SNAPSHOT" } android { diff --git a/sample/android-test/.gitignore b/sample/android-test/.gitignore deleted file mode 100644 index aa724b770..000000000 --- a/sample/android-test/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -*.iml -.gradle -/local.properties -/.idea/caches -/.idea/libraries -/.idea/modules.xml -/.idea/workspace.xml -/.idea/navEditor.xml -/.idea/assetWizardSettings.xml -.DS_Store -/build -/captures -.externalNativeBuild -.cxx -local.properties diff --git a/sample/android-test/app_api/.gitignore b/sample/android-test/app_api/.gitignore deleted file mode 100644 index 42afabfd2..000000000 --- a/sample/android-test/app_api/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/sample/android-test/app_api/build.gradle.kts b/sample/android-test/app_api/build.gradle.kts deleted file mode 100644 index beccb7f40..000000000 --- a/sample/android-test/app_api/build.gradle.kts +++ /dev/null @@ -1,40 +0,0 @@ -@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed -plugins { - alias(libs.plugins.androidApplication) - alias(libs.plugins.kotlinAndroid) -} - -android { - namespace = "com.example.app_api" - compileSdk = 34 - - defaultConfig { - minSdk = 24 - signingConfig = null - } - - buildTypes { - release { - isMinifyEnabled = false - } - } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = "1.8" - } -} - -dependencies { - - implementation(libs.core.ktx) - implementation(libs.appcompat) - implementation(libs.material) - implementation("androidx.startup:startup-runtime:1.0.0") - implementation(project(":app_impl")) - testImplementation(libs.junit) - androidTestImplementation(libs.androidx.test.ext.junit) - androidTestImplementation(libs.espresso.core) -} \ No newline at end of file diff --git a/sample/android-test/app_api/src/main/AndroidManifest.xml b/sample/android-test/app_api/src/main/AndroidManifest.xml deleted file mode 100644 index 9bc4654be..000000000 --- a/sample/android-test/app_api/src/main/AndroidManifest.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/sample/android-test/app_api/src/main/res/drawable/ic_launcher_background.xml b/sample/android-test/app_api/src/main/res/drawable/ic_launcher_background.xml deleted file mode 100644 index 07d5da9cb..000000000 --- a/sample/android-test/app_api/src/main/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sample/android-test/app_api/src/main/res/drawable/ic_launcher_foreground.xml b/sample/android-test/app_api/src/main/res/drawable/ic_launcher_foreground.xml deleted file mode 100644 index 2b068d114..000000000 --- a/sample/android-test/app_api/src/main/res/drawable/ic_launcher_foreground.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/sample/android-test/app_api/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/sample/android-test/app_api/src/main/res/mipmap-anydpi-v26/ic_launcher.xml deleted file mode 100644 index 6f3b755bf..000000000 --- a/sample/android-test/app_api/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/sample/android-test/app_api/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/sample/android-test/app_api/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index 6f3b755bf..000000000 --- a/sample/android-test/app_api/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/sample/android-test/app_api/src/main/res/mipmap-hdpi/ic_launcher.webp b/sample/android-test/app_api/src/main/res/mipmap-hdpi/ic_launcher.webp deleted file mode 100644 index c209e78ec..000000000 Binary files a/sample/android-test/app_api/src/main/res/mipmap-hdpi/ic_launcher.webp and /dev/null differ diff --git a/sample/android-test/app_api/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/sample/android-test/app_api/src/main/res/mipmap-hdpi/ic_launcher_round.webp deleted file mode 100644 index b2dfe3d1b..000000000 Binary files a/sample/android-test/app_api/src/main/res/mipmap-hdpi/ic_launcher_round.webp and /dev/null differ diff --git a/sample/android-test/app_api/src/main/res/mipmap-mdpi/ic_launcher.webp b/sample/android-test/app_api/src/main/res/mipmap-mdpi/ic_launcher.webp deleted file mode 100644 index 4f0f1d64e..000000000 Binary files a/sample/android-test/app_api/src/main/res/mipmap-mdpi/ic_launcher.webp and /dev/null differ diff --git a/sample/android-test/app_api/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/sample/android-test/app_api/src/main/res/mipmap-mdpi/ic_launcher_round.webp deleted file mode 100644 index 62b611da0..000000000 Binary files a/sample/android-test/app_api/src/main/res/mipmap-mdpi/ic_launcher_round.webp and /dev/null differ diff --git a/sample/android-test/app_api/src/main/res/mipmap-xhdpi/ic_launcher.webp b/sample/android-test/app_api/src/main/res/mipmap-xhdpi/ic_launcher.webp deleted file mode 100644 index 948a3070f..000000000 Binary files a/sample/android-test/app_api/src/main/res/mipmap-xhdpi/ic_launcher.webp and /dev/null differ diff --git a/sample/android-test/app_api/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/sample/android-test/app_api/src/main/res/mipmap-xhdpi/ic_launcher_round.webp deleted file mode 100644 index 1b9a6956b..000000000 Binary files a/sample/android-test/app_api/src/main/res/mipmap-xhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/sample/android-test/app_api/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/sample/android-test/app_api/src/main/res/mipmap-xxhdpi/ic_launcher.webp deleted file mode 100644 index 28d4b77f9..000000000 Binary files a/sample/android-test/app_api/src/main/res/mipmap-xxhdpi/ic_launcher.webp and /dev/null differ diff --git a/sample/android-test/app_api/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/sample/android-test/app_api/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp deleted file mode 100644 index 9287f5083..000000000 Binary files a/sample/android-test/app_api/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/sample/android-test/app_api/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/sample/android-test/app_api/src/main/res/mipmap-xxxhdpi/ic_launcher.webp deleted file mode 100644 index aa7d6427e..000000000 Binary files a/sample/android-test/app_api/src/main/res/mipmap-xxxhdpi/ic_launcher.webp and /dev/null differ diff --git a/sample/android-test/app_api/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/sample/android-test/app_api/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp deleted file mode 100644 index 9126ae37c..000000000 Binary files a/sample/android-test/app_api/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/sample/android-test/app_api/src/main/res/values/colors.xml b/sample/android-test/app_api/src/main/res/values/colors.xml deleted file mode 100644 index f8c6127d3..000000000 --- a/sample/android-test/app_api/src/main/res/values/colors.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - #FFBB86FC - #FF6200EE - #FF3700B3 - #FF03DAC5 - #FF018786 - #FF000000 - #FFFFFFFF - \ No newline at end of file diff --git a/sample/android-test/app_api/src/main/res/values/strings.xml b/sample/android-test/app_api/src/main/res/values/strings.xml deleted file mode 100644 index 0959d2b42..000000000 --- a/sample/android-test/app_api/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - SeparateTestModuleApp - \ No newline at end of file diff --git a/sample/android-test/app_api/src/main/res/values/themes.xml b/sample/android-test/app_api/src/main/res/values/themes.xml deleted file mode 100644 index 8d7ff04ef..000000000 --- a/sample/android-test/app_api/src/main/res/values/themes.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - -