问题描述
请问robotium具有工作在Android工作室的指导?请指导我提供一些很好的教程链接与Android工作室特别的工作。在此先感谢
Does robotium has a guide for working on Android Studio? Kindly guide me by providing some good tutorial links to work with Android Studio in particular.Thanks in advance
推荐答案
指南:
-
添加以下行到依赖内build.gradle部分文件(该文件位于同一级别的 SRC 文件夹),变化版本名称(如果需要):
Add the following line to the dependencies section of the inner build.gradle file (this file is located at the same level as src folder), change version name if required:
androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.2.1'
如果由于某种原因,你不想让摇篮下载依赖你,然后你可以手动添加:将robotium.jar到库文件夹。右键单击它并选择添加为库...
If for some reason you don't want to let gradle download dependencies for you thenyou can add them manually: Place robotium.jar into the libs folder. Right click it and select Add as library...
在 SRC 文件夹中创建另一个文件夹中的 androidTest
In the src folder create another folder androidTest
选择创建测试。选择适当的超类Robotium:
Select Create Test. Select the proper superclass for Robotium:
android.test.ActivityInstrumentationTestCase2
如何运行测试:
How to run the test:
- UI:像往常一样采用Android工作室的运行菜单
-
控制台:在终端中输入以下命令:
- UI: as usual using Android Studio Run menu
console: in the terminal enter the following command:
./gradlew connectedAndroidTest
HTML的报告将在生成YourApp / YourApp /编译/输出/报告/ androidTests /连接/ index.html的
The HTML-reports will be generated at "YourApp/YourApp/build/outputs/reports/androidTests/connected/index.html"
这篇关于Robotium与Android工作室的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!