gpt4 book ai didi

android - 运行junit测试时是否可以进入android的 Debug模式?

转载 作者:塔克拉玛干 更新时间:2023-11-01 22:07:05 29 4
gpt4 key购买 nike

通常我使用 adb shell am instrument -w com.android.contacts.tests/android.test.InstrumentationTestRunner 运行 junit 测试。它确实有效,它将运行我所有的测试。

但是当我在运行 junit 时设置断点并希望进入 Debug模式时,它失败了。当我调试普通的 Android 应用程序时,我设置断点的方式有效。

所以我搜索了网络,然后尝试类似adb shell am instrument -e debug true -e class com.android.contacts.AndroidUtilsTest -w com.android.contacts.tests/android.test.InstrumentationTestRunner,但仍然没有运气。你的如何解决这个问题?我不仅要调试junit类,还要调试普通项目中的代码。

最佳答案

我猜您正在尝试使用 Eclipse 调试您的测试。如果是这种情况,您只需选择您的测试项目,右键单击,Debug As... -> Android JUNit test,执行将在您设置的断点处停止在您的测试或代码中。

关于android - 运行junit测试时是否可以进入android的 Debug模式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10942049/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com