FAQ Database Discussion Community


Robotium best practice. clickOnView vs clickOnButton

android,testing,robotium
I was wondering if it is not better to always use solo.clickOnView(solo.getView(R.id.example_button)); to press on an button or solo.enterText((EditText) solo.getView(R.id.example_editText), "invalidEmail"); to enter en Text. When using the index solo.clickOnButton(0) to press on an button, the test will fail instant when UI has changed. Would this still be BlackBox Testing...

Android Espresso how to write tests using apk?

android,junit4,robotium,android-testing,android-espresso
I am a robotium user now switching to Espresso can anyone tell me how to write tests using apk in espresso, as we do in robotium without having acccess to the code but using app apk. And how to access views without R.id.viewid in espresso? as we do in robotium...

Execute command if view exists

android,robotium
I'm using robotium to write tests for our android application. I'm looking to execute a command if a certain view or text exists. It would be ideal to check if the view/button exists, but I'm open to checking if the logout text exists as well My (incorrect) pseudocode would be...

Not able to access Xml file when code is executed using Junit

xml,junit,robotium
I am working on "robotium with junit". I have come across the situation where, my code is not able to find the Xml file on the given path.(Provided that the specified path is correct). If I run the same code(file reading) with normal java then its working fine. But when...

Espresso How to access views without using R.id.viewid as we do in robotium?

android,junit4,robotium,android-testing,android-espresso
I am switching from robotium to espresso, I am writing tests using apk, I dont have access to code. In robotium using solo.getView("view-id") we can access the view but I am not geting how to do it in espresso? espresso witId() method needs R.id.viewid which I dont have access. public...

Robotium Android test a lot of applications with one test application

android,testing,robotium
I would like test a lot of applications with one Test application. I would write in the same test application every test method for my applications.. For example : I would like test MyBluetooth.class, MyWifi.class, MyGSM.class in the same Test Application but each class is in different package. How I...

Robolectric Samples and Gradle Plugin

android,android-studio,robotium,robolectric
In Robolectric sample project, there is no gradle plugin set up in build.gradle. For instance for AppCompat-v7 On the other hand we have Robolectric gradle plugin which as documentation says: A Gradle plugin which enables Robolectric tests. This plugin piggy-backs on the unit testing support added in version 1.1.0 of...

Change android setings programmatically

android,robotium
Can i click on NFC on/off button using robotium ? I know NFC cannot be turned on/off programatically unless device is rooted. But if i raise a popup for user to do so and then click on the on/off button. Just wanted to know is it possible ?

Robotium : Use in a “thrid” part project

android,robotium,android-library
As I'm doing some unit test on Android, I usually use Robotium. The core of this tool is really powerful but I made some helper classes and I would like to export them in a separate project so I can re-use them in all my projects. So I created a...

How to find out which Activity is on top of the stack using Robotium/Android SDK?

android,android-activity,robotium,android-sdk-tools
I have a Robotium test for an Android application, which extends ActivityInstrumentationTestCase2. The test operates on a loop, randomly clicking on active views. I would like to verify at the start of each iteration which Activity is currently focused. This behavior is important for me because one of the buttons...

About the android robotium release

android,testing,robotium
I have already finish most of the code of the robotium testing which is running on the android studio. I am just wondering which is the most effective way to make a release? To make a jar(how to do that)? Or make a interface? Because the QA team do not...

Lifecycle Testing with Robotium: Killing and Restarting Activity

java,android,robotium,android-testing
How is it possible to restart an activity that was ended using Robotium's solo.goBack()? The following does not restart the activity: (the test finishes ok) solo.goBack(); try { // recreate activity here runTestOnUiThread(new Runnable() { public void run() { getInstrumentation().callActivityOnCreate(getActivity(), null); getInstrumentation().callActivityOnStart(getActivity()); getInstrumentation().callActivityOnResume(getActivity()); }}); } How do you restart an...

Robotium : How can i test/check the values which i got on update screen are same as, the values which we have on one of the list view items

android,junit,robotium
I am learning "Robotium". I have one android application for testing. In this application i want to test an "Update" record functionality using "Robotium + jUnit". I am having perfectly working environment. Working: On List view screen, some database records are shown(id, name, contact no) in list view (screen shot...

How to catch exceptions using ActivityInstrumentationTestCase2?

android,testing,robotium,android-testing
I'm struggling to catch expected exceptions in test cases of my Android app using the class ActivityInstrumentationTestCase2. I wrote a very simple scenario that is raising the issue, and once this is solved I can probably do the same thing for my app. The snippet of the simple scenario is...

Robotium - Start another activity from main activity

android,robotium
I want to test an android app. The framework I chose was Robotium and I was able to write test cases that involved using single activity with(out) fragments. My problem is now I have my activity under test as activityA. From activityA, I want to disable some fields (which i...