i think tests in the instruementTest should relevant to android, so need i add an addtional source folder such as src/test/java? it looking that the testfile in src/test/java didn't compiled.
how can i run a junit test independently?
how can i run the junit test only in a command line, no the instrumentTest about android?
or put and junit test in the instruementTest folder and call
./gradlew connectedInstrumentTest
but,the unit test won't run at all.
There is experimental support for Android instrumentation tests, which requires some additional configuration & dependencies. Furthermore, because JUnit 5 is built on Java 8 from the ground up, its instrumentation tests will only run on devices running Android 8.0 (API 26) or newer.
To run all the tests in a default group, choose the Run icon and then choose the group on the menu. Select the individual tests that you want to run, open the right-click menu for a selected test and then choose Run Selected Tests (or press Ctrl + R, T).
I think this is not possible if you only have the Android plugin in your build.gradle. The only testing that is supported in the Android plugin is in the InstrumentTest folder. The normal test folder is only used by other plugins.
Next to that there is probably support needed in Android Studio itself. But not sure about that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With