jaredsburrows / gradle-spoon-plugin

Gradle plugin that provides a task to run Android instrumentation tests via Spoon.
https://jaredsburrows.github.io/gradle-spoon-plugin/
Apache License 2.0
126 stars 27 forks source link

Ambiguous arguments: cannot provide both test package and test class #3

Open hram opened 6 years ago

hram commented 6 years ago

Thank you for gradle 4 support

Can you tray run tests from specific package and help me?

In my case I was trying by setting instrumentation arguments:

instrumentationArgs = ["package=my.test.package.name"]

And this code works earlier in gradle 3 Now when I run tests as a result I get

== BUILD SUCCESSFUL ==

but no one test was running

After that I inspect logcat in found this exception

E/AndroidJUnitRunner: Fatal exception when running tests java.lang.IllegalArgumentException: Ambiguous arguments: cannot provide both test package and test class(es) to run at android.support.test.internal.runner.TestRequestBuilder.validate(TestRequestBuilder.java:828) at android.support.test.internal.runner.TestRequestBuilder.build(TestRequestBuilder.java:789) at android.support.test.runner.AndroidJUnitRunner.buildRequest(AndroidJUnitRunner.java:487) at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:373) at my.package.app.runner.UnlockDeviceAndroidJUnitRunner.onStart(UnlockDeviceAndroidJUnitRunner.java:44) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2075)

dweebo commented 6 years ago

This error message "Ambiguous arguments..." was introduced in spoon in https://github.com/square/spoon/pull/495

Are you also passing in instrumentationArgs for a class name? Or specifying a className as a parameter in the spoon section of your build.gradle?

hram commented 6 years ago

@dweebo i pass package name only

jaredsburrows commented 6 years ago

I believe just as @dweebo said, this is a Spoon 2 problem. Locally, I have use test size via @SmallTest, @MediumTest and @LargeTest.

jaredsburrows commented 6 years ago

Were you able to work around this @hram?