1.导入robotium-solo-5.2.1.jar 包 导入junit:4.12.jar
2.app— —src— —main— —libs 或者app-libs下 复制进去后,右键add as Library 导入jar包即可
3.在app-src-androidTest-ApplicationTest创建MainActivityTest.java 编写代码
在 src/androidTest ,与默认创建的 ApplicationTest 类同级的目录下创建一个 MainActivityTest
4. File Menu -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle -> Experimental
Enable all test artifacts (Unit Test and Instrumentation Test) in Android projects取消勾选,之后我们熟悉的Test Artifact选项了
5.点击as左侧build variants或者build-》select build variants
6.点击test Artifact 选择Android Instrumenttation Tests
7.运行测试用例