android-testing

Unit Testing in Android? [closed]

徘徊边缘 提交于 2019-12-22 17:46:55
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I am using Android Studio 1.2 Say I have a simple method add in some class MyAdder public int add(int a,int b) { return a+b; } I want to perform the unit test and use assertions to perform the test for the above-mentioned code. I found it tough, to begin with, Testing Fundamentals from the official DEV site so a

Robotium: Test run failed to complete. Expected N tests, received (N-1)

半腔热情 提交于 2019-12-22 10:06:21
问题 Android testing still remains my headache. I created the most simple app just to clear up how Robotium works, and each time tests fail with an error: Running tests Test running started Test failed to run to completion. Reason: 'Test run failed to complete. Expected 1 tests, received 0'. Check device logcat for details Test running failed: Test run failed to complete. Expected 1 tests, received 0 Once I had "Expected 3 tests, received 2" instead. The condition of using no-args constructor is

Simultaneous Running HAXM AVD Emulator Limit

☆樱花仙子☆ 提交于 2019-12-22 08:59:45
问题 To elaborate on the title, I'm running many simultaneous AVD's for my automated build/test processes (think concurrent builds for a project, or multiple projects building at once). Most problems that people have with running multiple HAXM accelerated AVD's at once is memory related. THIS IS NOT MY PROBLEM (I think). I have a pretty beefy i7 machine with 32gb of ram. When installing HAXM, I allocated 28gb (sorry, I can't post more pictures without more rep). Here is my AVD configuration(s).

Gradle Android test does not support filter (--tests)

爱⌒轻易说出口 提交于 2019-12-22 08:44:58
问题 Gradle Android test does not support filter (--tests). gradlew test --tests com.example.test.* works. gradlew connectedAndroidTest --tests com.example.test.* Error: Unknown command-line option '--tests'. 回答1: To run specific AndroidJUnit4 tests providing instrumentation runner is necessary to gradle. try this format: ./gradlew app:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.example.android.testing.blueprint.ui.espresso.EspressoTest Here is the list of all

Gradle: android instrumentation test without app source code

半城伤御伤魂 提交于 2019-12-22 06:37:54
问题 Before using gradle, it seems easy to do some black box testing with robotium or other instrumentation based automation framework, just need to indicate the targetPackage in AndroidManifest.xml <instrumentation android:name="com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner" android:targetPackage="xxxx" /> However gradle expects a project structure like this: src/main/ src/androidTest/ It simply use the app built from main (source code) as test target. And

Robolectric: NullPointerException in setupActivity()

主宰稳场 提交于 2019-12-22 05:23:44
问题 I'm trying to use Robolectric for testing my activities, but I'm always getting a NPE, when trying to setup the Activity with Robolectric. I have followed the guide from the robolectric.org website. Here is my code: @Config(constants = BuildConfig.class, sdk = Build.VERSION_CODES.LOLLIPOP, manifest = "src/main/AndroidManifest.xml") @RunWith(RobolectricTestRunner.class) @Ignore public class MainActivityUnitTest { private MainActivity activity; @Before public void setup() { activity =

leave Android app in final state on espresso test completion

爷,独闯天下 提交于 2019-12-21 20:06:26
问题 Is it possible to leave the app under test in whatever state it's in at the end of an espresso test? I don't care if it's failure or success. When I am working on developing a feature and a test for said feature it would be useful to just have the instrumentation app stop and leave the app under test alone in whatever state it happens to be in. This would allow me to play around manually or attach a debugger and see what is going on without running through the entire flow manually. Anyone

sources of Testing Support Library in Android Studio

折月煮酒 提交于 2019-12-21 17:28:05
问题 How to attach sources from android.support.test.* for debugging in AS? Tried downloading sources from https://android.googlesource.com/platform/frameworks/testing but the version doesn't seem to match my testing library version. Testing sources (for instance AndroidJunitRunner ) don't seem to be available via sdk manager, am I missing something ? 回答1: I encountered a similar problem and it took a quite amount of time to figure it out. It seems like a bug due to a missing Gradle task not

“No tests found” for instrumentation tests for Lollipop and above

烈酒焚心 提交于 2019-12-21 07:41:06
问题 My instrumentation based (espresso) tests don't run on Lollipop+ devices and emulators. They correctly run on any other platform. I have the same symptoms as the guy in this thread - https://groups.google.com/forum/?fromgroups#!topic/adt-dev/QW5SuzQizNk My tests are in src/androidTest/java/ I've set testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner' The test classes are @RunWith(AndroidJUnit4.class) Individual tests are annotated with @Test I can execute a ./gradlew

How to test app update on Google Play?

偶尔善良 提交于 2019-12-21 07:08:25
问题 Let's say I have the app in Google Play Store with version 1.0. In the new version (1.1) I would like to upgrade the database with new columns. Database upgrading is a common crash in my application because users in previous version (1.0) doesn't have the new columns in the database. I have tried to use the Google Play Store's beta testing feature, but the problem is there is no effective way (or at least I haven't found one yet) to do the following: Install a the current stable version (1.0)