-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add impact sample app. Fix some things while creating it (#556)
MBS-9347 Add impact sample app rename ReportType.kt to ConfigurationType.kt disable impact efficiency calculation when there are no tests add InstrumentationTestImpactAnalysisExtension.kt output default value
- Loading branch information
1 parent
5f9e84d
commit f730723
Showing
37 changed files
with
331 additions
and
42 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
plugins { | ||
id("com.android.library") | ||
id("kotlin-android") | ||
} | ||
|
||
android { | ||
|
||
/** | ||
* Disable all buildTypes except testing | ||
* to avoid confusing errors in IDE if wrong build variant is selected | ||
*/ | ||
variantFilter { | ||
if (name != testBuildType) { | ||
ignore = true | ||
logger.debug("Build variant $name is omitted for module: $path") | ||
} | ||
} | ||
|
||
testOptions { | ||
execution = "ANDROIDX_TEST_ORCHESTRATOR" | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
samples/test-app-impact/androidTest-core/src/main/AndroidManifest.xml
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,3 @@ | ||
<manifest | ||
package="com.avito.android.sample.impact.test.core"> | ||
</manifest> |
5 changes: 5 additions & 0 deletions
5
...ct/androidTest-core/src/main/kotlin/com/avito/android/sample/impact/ImpactScreenMarker.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,5 @@ | ||
package com.avito.android.sample.impact | ||
|
||
interface ImpactScreenMarker { | ||
val id: Int | ||
} |
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,43 @@ | ||
import com.avito.instrumentation.impact.InstrumentationTestImpactAnalysisExtension | ||
|
||
plugins { | ||
id("com.android.application") | ||
id("kotlin-android") | ||
id("com.avito.android.instrumentation-test-impact-analysis") | ||
} | ||
|
||
android { | ||
|
||
defaultConfig { | ||
versionName = "1.0" | ||
versionCode = 1 | ||
} | ||
|
||
/** | ||
* Disable all buildTypes except testing | ||
* to avoid confusing errors in IDE if wrong build variant is selected | ||
*/ | ||
variantFilter { | ||
if (name != testBuildType) { | ||
ignore = true | ||
logger.debug("Build variant $name is omitted for module: $path") | ||
} | ||
} | ||
|
||
testOptions { | ||
execution = "ANDROIDX_TEST_ORCHESTRATOR" | ||
} | ||
} | ||
|
||
extensions.configure<InstrumentationTestImpactAnalysisExtension> { | ||
screenMarkerClass.set("com.avito.android.sample.impact.ImpactScreenMarker") | ||
screenMarkerMetadataField.set("id") | ||
} | ||
|
||
dependencies { | ||
implementation(project(":samples:test-app-impact:feature-one")) | ||
implementation(project(":samples:test-app-impact:feature-two")) | ||
implementation(Dependencies.appcompat) | ||
androidTestImplementation(Dependencies.test.junit) | ||
androidTestImplementation(project(":samples:test-app-impact:androidTest-core")) | ||
} |
9 changes: 9 additions & 0 deletions
9
samples/test-app-impact/app/src/androidTest/kotlin/FeatureOneTest.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,9 @@ | ||
import com.avito.android.samples.impact.screen.FeatureOneScreen | ||
import org.junit.Test | ||
|
||
class FeatureOneTest { | ||
@Test | ||
fun test() { | ||
FeatureOneScreen() | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
samples/test-app-impact/app/src/androidTest/kotlin/FeatureTwoTest.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,10 @@ | ||
|
||
import com.avito.android.samples.impact.screen.FeatureTwoScreen | ||
import org.junit.Test | ||
|
||
class FeatureTwoTest { | ||
@Test | ||
fun test() { | ||
FeatureTwoScreen() | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
samples/test-app-impact/app/src/androidTest/kotlin/NotATest.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,2 @@ | ||
class NotATest { | ||
} |
9 changes: 9 additions & 0 deletions
9
samples/test-app-impact/app/src/androidTest/kotlin/WithoutScreenTest.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,9 @@ | ||
import org.junit.Test | ||
|
||
class WithoutScreenTest { | ||
|
||
@Test | ||
fun test() { | ||
|
||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...pp-impact/app/src/androidTest/kotlin/com/avito/android/samples/impact/screen/AppScreen.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,8 @@ | ||
package com.avito.android.samples.impact.screen | ||
|
||
import com.avito.android.sample.impact.ImpactScreenMarker | ||
import com.avito.android.sample.impact.R | ||
|
||
class AppScreen : ImpactScreenMarker { | ||
override val id: Int = R.layout.activity_app | ||
} |
11 changes: 11 additions & 0 deletions
11
...-app-impact/app/src/androidTest/kotlin/com/avito/android/samples/impact/screen/AppTest.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,11 @@ | ||
package com.avito.android.samples.impact.screen | ||
|
||
import org.junit.Test | ||
|
||
class AppTest { | ||
|
||
@Test | ||
fun test() { | ||
AppScreen() | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...ct/app/src/androidTest/kotlin/com/avito/android/samples/impact/screen/FeatureOneScreen.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,8 @@ | ||
package com.avito.android.samples.impact.screen | ||
|
||
import com.avito.android.sample.impact.ImpactScreenMarker | ||
import com.avito.android.sample.impact.R | ||
|
||
class FeatureOneScreen : ImpactScreenMarker { | ||
override val id: Int = R.layout.activity_feature_one | ||
} |
8 changes: 8 additions & 0 deletions
8
...ct/app/src/androidTest/kotlin/com/avito/android/samples/impact/screen/FeatureTwoScreen.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,8 @@ | ||
package com.avito.android.samples.impact.screen | ||
|
||
import com.avito.android.sample.impact.ImpactScreenMarker | ||
import com.avito.android.sample.impact.R | ||
|
||
class FeatureTwoScreen : ImpactScreenMarker { | ||
override val id: Int = R.layout.activity_feature_two | ||
} |
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,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="com.avito.android.sample.impact"> | ||
|
||
<application | ||
android:allowBackup="false" | ||
tools:ignore="GoogleAppIndexingWarning"> | ||
<activity android:name=".AppActivity" /> | ||
</application> | ||
|
||
</manifest> |
11 changes: 11 additions & 0 deletions
11
samples/test-app-impact/app/src/main/kotlin/com/avito/android/sample/impact/AppActivity.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,11 @@ | ||
package com.avito.android.sample.impact | ||
|
||
import android.os.Bundle | ||
import androidx.appcompat.app.AppCompatActivity | ||
|
||
class AppActivity : AppCompatActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_app) | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
samples/test-app-impact/app/src/main/res/layout/activity_app.xml
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,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".AppActivity"> | ||
|
||
</FrameLayout> |
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,25 @@ | ||
plugins { | ||
id("com.android.library") | ||
id("kotlin-android") | ||
} | ||
|
||
android { | ||
|
||
/** | ||
* Disable all buildTypes except testing | ||
* to avoid confusing errors in IDE if wrong build variant is selected | ||
*/ | ||
variantFilter { | ||
if (name != testBuildType) { | ||
ignore = true | ||
logger.debug("Build variant $name is omitted for module: $path") | ||
} | ||
} | ||
|
||
testOptions { | ||
execution = "ANDROIDX_TEST_ORCHESTRATOR" | ||
} | ||
} | ||
dependencies { | ||
implementation(Dependencies.appcompat) | ||
} |
9 changes: 9 additions & 0 deletions
9
samples/test-app-impact/feature-one/src/main/AndroidManifest.xml
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,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.avito.android.sample.impact.feature_one"> | ||
|
||
<application> | ||
<activity android:name=".FeatureOneActivity" /> | ||
</application> | ||
|
||
</manifest> |
11 changes: 11 additions & 0 deletions
11
...ure-one/src/main/kotlin/com/avito/android/sample/impact/feature_one/FeatureOneActivity.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,11 @@ | ||
package com.avito.android.sample.impact.feature_one | ||
|
||
import android.os.Bundle | ||
import androidx.appcompat.app.AppCompatActivity | ||
|
||
class FeatureOneActivity : AppCompatActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_feature_one) | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
samples/test-app-impact/feature-one/src/main/res/layout/activity_feature_one.xml
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,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".FeatureOneActivity"> | ||
|
||
</FrameLayout> |
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,25 @@ | ||
plugins { | ||
id("com.android.library") | ||
id("kotlin-android") | ||
} | ||
|
||
android { | ||
|
||
/** | ||
* Disable all buildTypes except testing | ||
* to avoid confusing errors in IDE if wrong build variant is selected | ||
*/ | ||
variantFilter { | ||
if (name != testBuildType) { | ||
ignore = true | ||
logger.debug("Build variant $name is omitted for module: $path") | ||
} | ||
} | ||
|
||
testOptions { | ||
execution = "ANDROIDX_TEST_ORCHESTRATOR" | ||
} | ||
} | ||
dependencies { | ||
implementation(Dependencies.appcompat) | ||
} |
9 changes: 9 additions & 0 deletions
9
samples/test-app-impact/feature-two/src/main/AndroidManifest.xml
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,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.avito.android.sample.impact.feature_two"> | ||
|
||
<application> | ||
<activity android:name=".FeatureTwoActivity" /> | ||
</application> | ||
|
||
</manifest> |
11 changes: 11 additions & 0 deletions
11
...ure-two/src/main/kotlin/com/avito/android/sample/impact/feature_two/FeatureTwoActivity.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,11 @@ | ||
package com.avito.android.sample.impact.feature_two | ||
|
||
import android.os.Bundle | ||
import androidx.appcompat.app.AppCompatActivity | ||
|
||
class FeatureTwoActivity : AppCompatActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_feature_two) | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
samples/test-app-impact/feature-two/src/main/res/layout/activity_feature_two.xml
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,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".FeatureTwoActivity"> | ||
|
||
</FrameLayout> |
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
3 changes: 3 additions & 0 deletions
3
subprojects/gradle/impact-shared/src/main/java/com/avito/impact/ConfigurationType.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,3 @@ | ||
package com.avito.impact | ||
|
||
enum class ConfigurationType { IMPLEMENTATION, UNIT_TESTS, ANDROID_TESTS, LINT } |
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
3 changes: 0 additions & 3 deletions
3
subprojects/gradle/impact-shared/src/main/java/com/avito/impact/ReportType.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.