简体   繁体   English

Android Studio单元测试

[英]Android Studio Unit Tests

I feel dumb for even having to ask this, but I can't find an answer anywhere. 我甚至不得不问这个问题,我感到愚蠢,但我无法在任何地方找到答案。 I'm trying to write simple unit tests that test static methods from my Android app and I've already added 我正在尝试编写简单的单元测试来测试我的Android应用程序中的静态方法,我已经添加了

// Required -- JUnit 4 framework
testCompile 'junit:junit:4.12'
testCompile "org.mockito:mockito-core:1.9.5"

To my app build.gradle file, but org.junit.test annotations or anything related to Junit4 will NOT resolve. 对于我的app build.gradle文件,但org.junit.test注释或与Junit4相关的任何内容都无法解决。 There is no "Unit Test" build variant either. 也没有“单元测试”构建变体。

失败

Can anybody assist me? 任何人都可以帮助我吗? Thanks. 谢谢。

看起来你没有下载依赖项:如果您的IDE有此选项,请尝试运行“gradle build”或同步gradle项目

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM