robotium

android自动化测试[一]

这一生的挚爱 提交于 2019-11-30 17:38:12
1、安装JDK 6、Android SDK 2.3 2、安装Eclipse 3.5.2、ADT8.0.1 https://dl-ssl.google.com/android/eclipse/ 3、HelloAndroid E:/Program Files/Android/android-sdk-windows/docs/resources/tutorials/hello-world.html 4、Android UnitTest hello testing: E:/Program Files/Android/android-sdk-windows/docs/resources/tutorials/testing/helloandroid_test.html Activity testing: E:/Program Files/Android/android-sdk-windows/docs/resources/tutorials/testing/activity_test.html 5、Robotium Tutorial: D:/Android/robotium/RobotiumForBeginners.pdf http://code.google.com/p/robotium/wiki/Getting_Started example: http://wiebe-elsinga

How to start Instrumentation project programmatically using Android Intent?

旧街凉风 提交于 2019-11-30 10:00:50
one way to start testcase is, adb shell am instrument -w com.google.vishal.test/android.test.InstrumentationTestRunner i want to start this using Android code (with intent) for example, adb shell am start -n com.google.android.contacts/.ContactsActivity we can run using Android intent by following method :- Intent intent = new Intent(com.google.android.contacts, ContactsActivity.class); startActivity(intent); But, how to run adb shell am instrument -w com.google.vishal.test/android.test.InstrumentationTestRunner by Android intent ? Thanks for your help in advance :-) Command to start

How to rotate activity, I mean: screen orientation change using Espresso?

喜欢而已 提交于 2019-11-30 06:41:31
I have decided that one of the testing criteria for my application tests with Google's Espresso is: Test should maintain Activity state after screen orientation rotation How do I rotate the screen when using Espresso? I have tried the following Robotium code (Yes I placed Robotium code in my Espresso test so sue me) solo.setActivityOrientation(solo.LANDSCAPE); solo.setActivityOrientation(solo.PORTRAIT); but It crashes the application when I run it within my Espresso test. Is there any way to do this? Thanks in advance for any help If you have the only Activity in your test case, you can do: 1.

How can I run a single test with gradle android

穿精又带淫゛_ 提交于 2019-11-30 03:16:14
I'm trying to run the tests with this line... but this launches all tests: ./gradlew -DconnectedAndroidTest.single=LandingActivityTests connectedAndroidTest How can I launch a single test? you can run the single android test in two steps: ./gradlew installDebugAndroidTest adb shell am instrument -w -e class com.example.MyInstrumentationTest#testFoo com.example.test/android.support.test.runner.AndroidJUnitRunner https://developer.android.com/tools/testing/testing_otheride.html Since Android Gradle plugin version 1.3.0 you can use ./gradlew -Pandroid.testInstrumentationRunnerArguments.class=your

mac上设置robotium环境的总结

北城余情 提交于 2019-11-29 14:06:21
在mac上配置robotium环境,需要注意以下几点: java jdk+jre的安装和环境变量的设置 eclipse的安装 eclipse上安卓sdk和adt的扩展和安装 安卓环境变量的设置 eclipse/mac上对安卓真机的设置:http://my.oschina.net/u/855532/blog/403077 apk的反编译:http://my.oschina.net/u/855532/blog/403095 apk的重签名:http://my.oschina.net/u/855532/blog/397471 robotium下载和使用 来源: oschina 链接: https://my.oschina.net/u/855532/blog/403232

Iterating through a List and clicking on list items in Robotium

让人想犯罪 __ 提交于 2019-11-29 12:47:01
I'm trying to run some automated tests in Robotium by iterating through a list and clicking on each list element to start another activity. I have the code below in my test method: Code: solo.assertCurrentActivity("Wrong activity", MainActivity.class); //Clicks on the action bar tab solo.clickOnText("Charts"); ArrayList<ListView> list = solo.getCurrentListViews(); for(int i = 0; i < list.size(); i++) { //Clicks on the list item assert that the new activity is started solo.clickInList(chartPosition); solo.assertCurrentActivity("Json Class", JsonActivity.class); //Go back to the list solo.goBack

How to rotate activity, I mean: screen orientation change using Espresso?

无人久伴 提交于 2019-11-29 05:51:37
问题 I have decided that one of the testing criteria for my application tests with Google's Espresso is: Test should maintain Activity state after screen orientation rotation How do I rotate the screen when using Espresso? I have tried the following Robotium code (Yes I placed Robotium code in my Espresso test so sue me) solo.setActivityOrientation(solo.LANDSCAPE); solo.setActivityOrientation(solo.PORTRAIT); but It crashes the application when I run it within my Espresso test. Is there any way to

How to use Robotium with Android Studio?

痞子三分冷 提交于 2019-11-28 16:04:03
问题 Robotium is an Android test automation framework that has full support for native and hybrid applications. Now that Android Studio is the de facto IDE for Android development, I'm interested to try this with Android Studio. However, I couldn't find a way to set it up. How to setup and use Robotium to test with Android Studio? 回答1: Guide: 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

robotium+ant+android-junit-report

独自空忆成欢 提交于 2019-11-28 11:37:42
根据此链接的步骤为现有的robotium项目自动生成ant的build.xml文件:http://xiaomaozi.blog.51cto.com/925779/932284/ 根据此链接的步骤将android-junit-report.jar导入项目并根据链接上的内容操作:http://www.xuebuyuan.com/2148574.html http://www.tuicool.com/articles/Rzayie 将如下代码加入到build.xml文件中去: < target name = "fetch-test-report" > < xpath input = "${tested.project.dir}/AndroidManifest.xml" expression = "/manifest/instrumentation/ @android :targetPackage" output = "tested.package" /> < echo > Downloading XML test report... </ echo > < mkdir dir = "${reports.dir}" /> < exec executable = "${adb}" failonerror = "true" > < arg line = "${adb.device.arg}"

Iterating through a List and clicking on list items in Robotium

点点圈 提交于 2019-11-28 06:17:21
问题 I'm trying to run some automated tests in Robotium by iterating through a list and clicking on each list element to start another activity. I have the code below in my test method: Code: solo.assertCurrentActivity("Wrong activity", MainActivity.class); //Clicks on the action bar tab solo.clickOnText("Charts"); ArrayList<ListView> list = solo.getCurrentListViews(); for(int i = 0; i < list.size(); i++) { //Clicks on the list item assert that the new activity is started solo.clickInList