Comments (10)
What is the error you see in Android Studio?
from testing-samples.
I just used gradle in terminal, the build seems to be success, but if you check the unit test results: there is nothing, just adding a error to some unit tests files, build still success because files where never compiled.
I tried now with AndroidStudio,
and got this error:
Test filtering is not supported for given version of JUnit. Please upgrade JUnit version to at least 4.6.
from testing-samples.
What task are you using to run the tests? This are device/emulator tests, not local-JVM tests. You can find instructions in the README.md file.
from testing-samples.
I am using Android Studio. I right-click on the test file and run it.
from testing-samples.
ok, so for unittesting/BasicUnitAndroidTest
I run on console:
gradle clean test
-> build success but unit tests not executed, (could be seen by either making a compile error into the class: LogHistoryAndroidUnitTest or when opening the unit test reports
with ./gradlew clean test
the same
gradle --version
(installed with brew)
------------------------------------------------------------
Gradle 2.3
------------------------------------------------------------
Build time: 2015-02-16 05:09:33 UTC
Build number: none
Revision: 586be72bf6e3df1ee7676d1f2a3afd9157341274
Groovy: 2.3.9
Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM: 1.8.0_31 (Oracle Corporation 25.31-b07)
OS: Mac OS X 10.10.2 x86_64
./gradlew --verion
------------------------------------------------------------
Gradle 2.2.1
------------------------------------------------------------
Build time: 2014-11-24 09:45:35 UTC
Build number: none
Revision: 6fcb59c06f43a4e6b1bcb401f7686a8601a1fb4a
Groovy: 2.3.6
Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM: 1.8.0_31 (Oracle Corporation 25.31-b07)
OS: Mac OS X 10.10.2 x86_64
now I go to Android Studio,
import new Project, use gradle wrapper.
right click on the LogHistoryAndroidUnitTest and execute Unit test:
I first get this error: Gradle error - Execution failed for task ':app:dexDebug'
now I change settings in AndroidStudio to use my local gradle version,
try to run the test again, this time with this error: **!!! JUnit version 3.8 or later expected:
java.lang.RuntimeException: Stub!**
when I try to execute gradle test from Android Studio I get this error: Execution failed for task ':app:testDebug'.
Test filtering is not supported for given version of JUnit. Please upgrade JUnit version to at least 4.6.
so I never get the unit test running, don't know what I do wrong :/
back to Console
when I rename app/src/androidTest/ to app/src/test/
and run gradle test
again i get a lot of compile errors:
unittesting/basicunitandroidtest/LogHistoryAndroidUnitTest.java:20: error: package android.support.test.runner does not exist import android.support.test.runner.AndroidJUnit4;
this this time the class is found but not the dependencies...
if I change in app.gradle the dependencies from androidTestCompile to testCompile
and run gradle test
again
i will end up with this error
java.lang.Exception: Custom runner class AndroidJUnit4 should have a public constructor with signature AndroidJUnit4(Class testClass)
if you have any idea what i do wrong please tell me, because i have the same behavior with my own project...
Also i don't get why AndroidStudio seems to work different, i kind of executing the Unit Test directly , or with gradle, and it also differs from the console.
I would expect that using gradle from console or AndroidStudio should be no difference ?
from testing-samples.
These tests are not run locally but in device/emulator, so they live in androidTest and should be executed using the connectedCheck
task or from Android Studio using the instructions found in the README in the root of the project.
from testing-samples.
ahhhhh, ok got it, now all this test and androitTest makes sense ....
its working now as it should, also unit tests in my project are working :)
sorrryyy guys for noise :(
from testing-samples.
Hi fmt,
Do you manage to get it running?
How you fix the error?
java.lang.Exception: Custom runner class AndroidJUnit4 should have a public constructor with signature AndroidJUnit4(Class testClass)
Thanks a lot
from testing-samples.
the error was on my side.
for android test you need an emulator than its running as is it should
from testing-samples.
Hi I intend to use AndroidJUnit4. If I take out RunWith Android JUnit4 then no issue.. I mean the local unit test without device
from testing-samples.
Related Issues (20)
- Bébé HOT 1
- Cannot run tests with Android Test Orchestrator using `adb` HOT 2
- Could not resolve com.android.tools.utp:android-test-plugin-host-additional-test-output:30.3.1 HOT 1
- `captureToBitmap` clips the image to the device screen size HOT 1
- testInstrumentationRunnerArguments clearPackageData in kotlin dsl and recent gradle HOT 1
- Support test validation on GitHub Actions HOT 2
- instrumentation app can use proguard?
- A
- Test HOT 1
- A HOT 1
- Run HOT 1
- Test HOT 1
- A
- Aa
- A
- My sample
- ScreenshotTestSample with Gradle Manged Devices and several shards generates screenshots for last shard only
- Not compiling test class with a fragment that not inherits directly but indirectly from Fragment class
- Gradle Managed Device not able to run with Orchestrator HOT 8
- [Bazel CI] Error: 'android_instrumentation_test' is not defined with bazel@HEAD HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
đ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. đđđ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google â€ïž Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from testing-samples.