对于gradle,从版本1.0(或1.1)开始,从命令行执行特定测试应该有效,但它在版本2.7上不起作用。
我尝试了下面的命令:
gradle test --tests com.mk.myfirstapp.MyUT
gradle输出'未知的cmdline选项':
FAILURE: Build failed with an exception.
* What went wrong:
Problem configuring task :app:test from command line.
> Unknown command-line option '--tests'.
* Try:
Run gradle help --task :app:test to get task usage details. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 3.505 secs
对于像
这样的另一个命令也是如此gradle -Dtest.single=abc test
有谁知道这是一个错误或我的误用?谢谢。
更多详情
我做的与欧宝(下图)相同,但我有不同的结果。我的朋友有什么问题: - ?
mk@mk-desktop:~/StudioProjects/MyFirstApp$ gradle -v ------------------------------------------------------------ Gradle 2.7 ------------------------------------------------------------ Build time: 2015-09-14 07:26:16 UTC Build number: none Revision: c41505168da69fb0650f4e31c9e01b50ffc97893 Groovy: 2.3.10 Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013 JVM: 1.8.0_51 (Oracle Corporation 25.51-b03) OS: Linux 3.5.0-44-generic amd64 mk@mk-desktop:~/StudioProjects/MyFirstApp$ gradle test --tests BlogFeedEndpointSpec WARNING: Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for debug as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages WARNING: Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for debug as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages WARNING: Dependency org.json:json:20150407-jdk16 is ignored for debug as it may be conflicting with the internal version provided by Android. In case of problem, please repackage with jarjar to change the class packages WARNING: Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for release as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages WARNING: Dependency org.apache.httpcomponents:httpclient:4.5.1 is ignored for release as it may be conflicting with the internal version provided by Android. In case of problem, please repackage it with jarjar to change the class packages WARNING: Dependency org.json:json:20150407-jdk16 is ignored for release as it may be conflicting with the internal version provided by Android. In case of problem, please repackage with jarjar to change the class packages FAILURE: Build failed with an exception. * What went wrong: Problem configuring task :app:test from command line. > Unknown command-line option '--tests'. * Try: Run gradle help --task :app:test to get task usage details. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED Total time: 3.574 secs
答案 0 :(得分:0)
--tests
选项:
➜ backend git:(master) gradle -v
------------------------------------------------------------
Gradle 2.7
------------------------------------------------------------
Build time: 2015-09-14 07:26:16 UTC
Build number: none
Revision: c41505168da69fb0650f4e31c9e01b50ffc97893
Groovy: 2.3.10
Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM: 1.8.0_05 (Oracle Corporation 25.5-b02)
OS: Mac OS X 10.10.4 x86_64
➜ backend git:(master) gradle test --tests BlogFeedEndpointSpec
:compileJava UP-TO-DATE
:compileGroovy UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:compileTestJava UP-TO-DATE
:compileTestGroovy UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> No tests found for given includes: [BlogFeedEndpointSpec]
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 6.88 secs