用gradle运行特定的单元测试 [英] Running a specific unit test with gradle

查看:883
本文介绍了用gradle运行特定的单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法使用Gradle来运行特定的Android单元测试?我试过了

  gradle -Dtest.single = UnitTestName connectedInstrumentTest 

但它似乎运行包中的所有测试。



预先感谢,
Ivan。

解决方案

模式是 -D< testTaskName> .single =< TestClass> code>在你的例子中它应该是:
$ b $ pre $ gradle -DconnectedInstrumentTest.single = UnitTestName connectedInstrumentTest




注意:此答案已过时。您应该在最新版本的Gradle中使用 - tests 开关。 (请参阅其他解释)



Is there a way to run a specific Android unit test using Gradle? I've tried

gradle -Dtest.single=UnitTestName connectedInstrumentTest

but it seems to run all the tests in the package.

Thanks in advance, Ivan.

解决方案

The pattern is -D<testTaskName>.single=<TestClass> so in your example it should be:

gradle -DconnectedInstrumentTest.single=UnitTestName connectedInstrumentTest

NOTE: This answer is outdated. You should use the --tests switch in the latest versions of Gradle. (see other answers for an explanation)

这篇关于用gradle运行特定的单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆