从命令行运行Android Junit测试 [英] Running Android Junit tests from command line

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

问题描述

我想从命令行运行Junit测试,但是当我运行此命令

I want to be able to run Junit tests from the command line, but when I run this command

java -cp /usr/share/java/junit.jar org.junit.runner.JUnitCore [test class name]

我回来的是

OK (0 tests)

它与Android项目有关吗?我之前运行过这个命令,没有太多问题。

Does it have something to do with it being an Android project? I've run that command before and haven't had much issue.

推荐答案

我刚刚设法从命令行运行JUnit测试,但使用adb shell。

I just managed to run JUnit tests from command line, but using an adb shell.

命令为

./adb shell am instrument -w com.dddforandroid.api/android.test.InstrumentationTestRunner

更多详情此处

这篇关于从命令行运行Android Junit测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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