Robotium与Android工作室工作室、Robotium、Android

2023-09-05 05:38:59 作者:沉默我的资本の

请问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 then you 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

Android的工作室将创建一个测试文件和一个包(如果在步骤6中未创建)

如何运行测试:

Android studio will create a test file and a package (if it wasn’t created in step 6)

How to run the test:

UI:像往常一样采用Android工作室的运行菜单

控制台:在终端中输入以下命令: UI: as usual using Android Studio Run menu Robotium

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"