robotium

How to click on a button, which is indexed at 10 position in ListView - Robotium automation?

大兔子大兔子 提交于 2019-12-10 15:27:28
问题 Suppose, I have a ListView, which contains 20 ListItems. Each item is having a button, now I want to click a button which is located at 10 position in ListView. How I can automate it via robotium? 回答1: Try to do ti like this (not sure if it works) //get the list view ListView myList = (ListView)solo.getView(R.id.list); //get the list element at the position you want View listElement = myList.getChildAt(10);// myList is local var //click on imageView inside that list element solo.clickOnView

Continue Android tests after an exception

℡╲_俬逩灬. 提交于 2019-12-10 14:47:08
问题 When running my test suite in Android Studio, occasionally there will be an exception thrown from somewhere in my code (not in the test) which will cause the current test to fail (good because the test has found a bug) and the rest of the tests to stop running (not so good). I'd like the tests to continue running so that the entire suite finishes. Is this possible? 回答1: it is not possible by concept of INTERPRETER and COMPILER. Android uses jvm(java virtual machine) and JIT (just in time)

How to check if text is present in clipboard in Robotium test?

痴心易碎 提交于 2019-12-10 11:45:52
问题 I am testing my Android application using Robotium. In a dialog, I have a button that will copy the text in the dialog to the clipboard. Is it possible to access the clipboard in my test to see if the text has been copied after the button has been pressed? If so, how? 回答1: You can use the clipboard manager service in the same way you do in your application and then use its getText() method to retrieve the value. It should look something like (untested, from memory and I have had a few drinks.

Android Toast Accumulation Testing

早过忘川 提交于 2019-12-10 11:45:43
问题 Like many others, i've been trying to solve the problem of toast accumulation. How to prevent Multiple Toast Overlaps toast issue in android Cancelling an already open toast in Android Best way to avoid Toast accumulation in Android I finally decided to keep track of the current displayed toast and cancel it when another arrives (there's some more logic involved), but i could have use only one toast and change it message. What i want to know is this... Is there a way to TEST this behaviour?

Managing project dependencies in Eclipse

孤人 提交于 2019-12-10 11:34:41
问题 I see a number of posts on this, but I'm still struggling. I've got a workspace with two projects, one with the robotium library and one using it(we'll call this one foo). I would like to click run on foo, and have it re-compile robotium into a jar, add it to foo's build path, and then run foo. How can I do this? Also, I'm starting to learn maven so I'm not opposed to doing this that way, I just don't know how -- I've been assuming this is something Eclipse can do standalone. 回答1: You can

slow or fast drag up (scroll) using robotium

醉酒当歌 提交于 2019-12-09 17:28:14
问题 this my code for drag up current screen. int screenWidth = getActivity().getWindowManager().getDefaultDisplay().getWidth(); int screenHeight = getActivity().getWindowManager().getDefaultDisplay().getHeight(); int fromX, toX, fromY, toY = 0; fromX = screenWidth/2; toX = screenWidth/2; fromY = (screenHeight/2) + (screenHeight/3); toY = (screenHeight/2) - (screenHeight/3); int scroll_time = 10000; solo.sleep(5000); // Drag UP solo.drag(fromX, toX, fromY, toY, 40); Log.d(TAG, "Drag 1"); // here

Installing an Android apk programmatically as part of a test framework

老子叫甜甜 提交于 2019-12-09 17:17:50
问题 I'm attempting to install an apk programmatically, but I'm not having much luck. I'm setting up an automated test framework targeting physical devices, and I want to have the test devices retrieve the latest apk from the build server before running tests. While I am aware that there is no general way to actually install an apk without the user's consent, I'm curious if there might be some approach available in the case where a developer owns both the apk and device. Approaches I've tried in

Java Robotium Android - Run same test simultaneosly on two different devices

我是研究僧i 提交于 2019-12-09 13:05:34
问题 I want to run an Android Robotium test on two devices simultaneosly. I couldn't find any solution by now... To be more precise, I have an application-test.apk wich contains multiple instrumentation classes. I want to run the same test apk, but different test classes on both devices. I know that I can run the tests only in serial mode, with adb. 回答1: You can use the -s flag to point an adb command to a specific device. This means that you can just open up two terminals and using the -s flag

(Robotium) Action bar up/home button click

人走茶凉 提交于 2019-12-09 00:57:15
问题 I use Robotium as the library for Junit test for my Android application. I wrote some tests which works well. But when I try to write a test for native ActionBar's Up/Home button click , it failed. My test code is very simple: Solo solo = new Solo(getInstrumentation(), getActivity()); ... solo.clickOnActionBarHomeButton(); // I expected it will click the Up/Home button of ActionBar I expected the above code will click the Up/Home button of native ActionBar, but it is failed, nothing was

How to run Android/ Robotium Instrumentation test cases against a release version APK?

余生长醉 提交于 2019-12-08 17:45:21
问题 I have an Android project setup with its pure Java unit test project running on PC, and its functional/ integration test projects running on Emulator. Those two make use of InstrumentationTestCase2 test cases and also Robotium framework. I'm able to run those two from Eclipse, against the debug version of my app and collect results and so on. I'm able to create a release APK both thru Eclipse export and Ant build. APK is signed, zipaligned and obfuscated. I'd like to know how to run those