vendredi 1 avril 2016

Unable to find instrumentation info for: ComponentInfo{} - while packagename for ProductFlavor was changed manually

I try to run an Instrumentation Test for a certain flavor of my android app and always get this:

Test running failed: Unable to find instrumentation info for:     ComponentInfo{<packackename>/android.support.test.runner.AndroidJUnitRunner}
Empty test suite.

This happens only in a certain productFlavor where I had to change the packagename in the build.gradle "manually" with:

 applicationVariants.all { variant ->
    def flavorName = variant.getVariantData().getVariantConfiguration().getFlavorName()
    def mergedFlavour = variant.getVariantData().getVariantConfiguration().getMergedFlavor();

    if (flavorName.toLowerCase().contains("foobar")) {
        mergedFlavour.setApplicationId(mergedFlavour.getApplicationId() + ".foobar")
    }
}

I already tried to do the same thing in the android-testing.gradle but actually all packagenames are looking fine:

Installing de.test.foobar.debug
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/de.test.foobar.debug"
pkg: /data/local/tmp/de.test.foobar.debug
Success

Installing APK: 
Uploading file to: /data/local/tmp/de.test.foobar.debug.test
Installing de.test.foobar.debug.test
DEVICE SHELL COMMAND: pm install -r     "/data/local/tmp/de.test.foobar.debug.test"
pkg: /data/local/tmp/de.test.foobar.debug.test
Success

If I remove the "manual" change of the packagename of this specific productflavor, all tests are executed fine. I already tried to change the instrumentationRunner and made sure that it is the same in the configuration of the test execution - but unfortunately without luck...

Is there maybe a possibility to override the changed applicationId if the test is executed?

Thanks for every input!

Aucun commentaire:

Enregistrer un commentaire