Questions tagged [android-testing]

The Android testing framework

The Android testing framework, an integral part of the development environment, provides an architecture and powerful tools that help you test every aspect of your application at every level from unit to framework.

The testing framework has these key features:

  • Android test suites are based on JUnit. You can use plain JUnit to test a class that doesn't call the Android API, or Android's JUnit extensions to test Android components. If you're new to Android testing, you can start with general-purpose test case classes such as AndroidTestCase and then go on to use more sophisticated classes.
  • The Android JUnit extensions provide component-specific test case classes. These classes provide helper methods for creating mock objects and methods that help you control the lifecycle of a component.
  • Test suites are contained in test packages that are similar to main application packages, so you don't need to learn a new set of tools or techniques for designing and building tests.
  • The SDK tools for building and tests are available in Eclipse with ADT, and also in command-line form for use with other IDEs. These tools get information from the project of the application under test and use this information to automatically create the build files, manifest file, and directory structure for the test package.
  • The SDK also provides monkeyrunner, an API for testing devices with Python programs, and UI/Application Exerciser Monkey, a command-line tool for stress-testing UIs by sending pseudo-random events to a device.
2161 questions
1
vote
0 answers

Testing views in layout using dimension values from dimen.xml throws error in Robolectric 2.2

Am using the robolectric-2.2-20130606.235928-4-jar-with-dependencies.jar in testing the Android app. view am using in my testing is given below. Dimension value is referred from…
Navin GV
  • 700
  • 3
  • 10
  • 24
1
vote
0 answers

Cannot link/deploy/display android.R.drawable.ic_dialog_info on my hardware device

AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setIcon(android.R.drawable.ic_dialog_info); The above code should create an alert-dialog with the drawable resource android.R.drawable.ic_dialog_info. This code works…
1
vote
0 answers

How to ensure all events have been fired before moving forwarded

How do I ensure that all the ontouch, onclick, etc listeners have been fired in the UI thread before moving forward with the test code? In other words, I have a spinner on which I have registered both onTouchListener and OnItemSelectedListener. I…
Ritesh Kadmawala
  • 743
  • 9
  • 17
1
vote
1 answer

resetting phone caused apk to stop working

I have been working on testing in-app billing. Through the process, I learned that I needed to reset my device so as to wipe out my personal information or google would keep complainer about me not being able to purchase from myself. So indeed I…
Pouton Gerald
  • 1,625
  • 22
  • 32
1
vote
1 answer

get android sendevent coordinates scale factor

I am trying to write a script to test my application but when I use sendevent the x and y coordinates are wrong. when I check the getevent output I can see that the coordinates are multiplied by 1.65 how do I get this scale factor programmaticly ?
jacob
  • 1,397
  • 1
  • 26
  • 53
1
vote
1 answer

Android, Maven and Jackson

I'm trying to take Jackson into use in my Android app project. Everything else works nice but running tests in CI through Maven fail, if I run the same test from Eclipse it works but then I'm not using Maven POM files i.e. I'm not importing the…
pmellaaho
  • 792
  • 1
  • 8
  • 15
1
vote
1 answer

Robolectric "Failed to create a android.widget.Button" error

When I try to run my robolectric tests I receive exception: java.lang.RuntimeException: Failed to create a android.widget.Button However if activity doesn't contains any buttons everything runs ok, but I need buttons :) I use robolectric…
Bersh
  • 2,789
  • 3
  • 33
  • 47
1
vote
2 answers

android-maven integration-test deploy not finding jar library at run-time

We are attempting to get some continuous integration testing online for an android library (.jar file, but not an android project with the library flag set) that we have written. I have created a test android project in IntelliJ and have managed to…
1
vote
0 answers

how can we write parametrized Test cases for android

As reference to Java JUnit doc... http://junit.sourceforge.net/javadoc/org/junit/runners/Parameterized.html I tried to implement the same in android, but did not work. Also I inherited Test class with different classes like "TestSuit",…
1
vote
1 answer

Android testing: How to change application before actvity is created?

When writing an android test case how can I call some methods on my application object before the activity is created? My test class extends ActivityInstrumentationTestCase2. Some of the things I've tried are Looking for a method my test case can…
Dave C
  • 928
  • 6
  • 12
1
vote
1 answer

Cannot run android ui tests from command line

I have created a simple ui test for an android application following this tutorial: http://developer.android.com/tools/testing/testing_ui.html Now I have build my project and uploaded the TestProject.jar file into a virtual device using: adb push…
1
vote
3 answers

Android Testing: What do to when nothing has an id?

I'm trying to write some automation scripts for an app I have. I've done the tutorial on Robotium's site and have a basic understanding on how I can automation. However from what I can tell regarding the app I'm testing is by using the android…
Scophotog
  • 41
  • 3
1
vote
2 answers

Using Robotium Solo 4.0 to change system clock

Is there any method built in to Robotium Solo 4.0 to change the system clock time? I understand that I could probably write some code to open the Settings app, navigate to the clock and change the time, but if something was built in to Robotium to…
DiscDev
  • 38,652
  • 20
  • 117
  • 133
1
vote
0 answers

Robotium Solo 4.0 pauses after typing text

I'm using Robotium Solo 4.0 to write some functional tests for an Android app. The following sequence is giving me issues. I'm running on a Nexus 4. View cartIcon = solo.getView(R.id.cartBtn); solo.clickOnView(cartIcon); //Animation happens in…
DiscDev
  • 38,652
  • 20
  • 117
  • 133
1
vote
1 answer

Using Robotium with a contextual menu

I'm testing an application with Robotium, and I have a custom listview with checkboxes. When I click on a checkbox it loads a contextual menu giving the user buttons to modify and delete those items. I can get Robotium to click the checkbox which…
Carrie Hall
  • 931
  • 3
  • 15
  • 30
1 2 3
99
100