TestImpactAnalysis

Introduction: TestImpactAnalysis demo
More: Author   ReportBugs   
Tags:

This sample project for asking help from Avito team. I am trying to apply com.avito.android.instrumentation-test-impact-analysis plugin to a multiple modules Android project to do Test Impact Analysis.

Project structure

:app (contain UI tests: Module1Test->Module1Activity, Module2Test -> Module2Activity)
  |-module1 (contain Module1Activity)
  |-module2 (contain Module2Activity)
  |-ui-test-base (contain Screen)

Plugin config

instrumentationTestImpactAnalysis {
    println(project)
    output.set(project.getBuildDir())
    screenMarkerClass = 'com.mk.ui_test_support.Screen'
    screenMarkerMetadataField = 'rootId'
}

What I have tried

Create a branch "test-branch-v2" and make a small change to Module2Activity in module2 by this commit And run this command locally:

./gradlew clean analyzeTestImpact -Pci=true -PgitBranch=test-branch-v2 -PtargetBranch=master -Pavito.stats.host=http://stub -Pavito.stats.fallbackHost=http://stub -Pavito.stats.port=80 -Pavito.stats.namespace=stub -PkubernetesToken=stub -PkubernetesUrl=stub -PkubernetesCaCertData=stub -Dorg.gradle.debug=false

What to be expected is the "tests-to-run.txt" should only contain the ui-test for Module2Activity, in this case it shoule be

com.mk.sampleexpressoproject.mp2.Module2Test.changeText_sameActivity

But the actual result show all of the ui test in app module.

com.mk.sampleexpressoproject.Module1Test.changeText_sameActivity
com.mk.sampleexpressoproject.Module1Test.changeText_newActivity
com.mk.sampleexpressoproject.mp2.Module2Test.changeText_sameActivity

Believe it happen because of my missunderstanding of the screenMarkerClass, screenMarkerMetadataField. Then, it triggered a fallback which result to run all of the ui tests.

Apps
About Me
GitHub: Trinea
Facebook: Dev Tools