[英]How to run unit tests located inside a android module?
[Note from the future, 2021, added at the bottom - they shortened the answer] [来自未来的注意事项,2021,添加在底部 - 他们缩短了答案]
Below i have a project with the above structure.下面我有一个具有上述结构的项目。
I can happily run uni tests fine inside the app module but unit tests found on the lib module doesn't get run unless i manually right click DummyDataTest.java inside the lib module and click run unit test inside Android studio.我可以愉快地在 app 模块中运行 uni 测试,但是在 lib 模块上找到的单元测试不会运行,除非我手动右键单击 lib 模块中的 DummyDataTest.java 并单击 Android Studio 中的运行单元测试。
Is there a way to automatically run unit tests located in my lib module through command line?有没有办法通过命令行自动运行位于我的 lib 模块中的单元测试?
The existing command line ./gradlew testDebug only runs the unit tests located inside the app module.现有的命令行 ./gradlew testDebug 只运行位于 app 模块内的单元测试。
Thanks in advance提前致谢
JUnitTestProject
app [module]
src
main
java
de.ivu.junittest.app
DummyModel.java
...
...
test
java
de.ivu.junittest.app
DummyModelTest.java
...
lib [module]
src
main
java
de.ivu.junittest
DummyData.java
...
...
test
java
de.ivu.junittest.app
DummyDataTest.java
...
是的,使用./gradlew lib:testDebugUnitTest
从 lib 模块运行测试。
$ ./gradlew lib:testDebugUnitTest $ ./gradlew lib:testDebugUnitTest
FAILURE: Build failed with an exception.
* What went wrong:
Project 'lib' not found in root project 'Yo'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
$ ./gradlew testDebugUnitTest
Happiness幸福
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.