android-testing

Unlocking the emulator or device for Android test

╄→尐↘猪︶ㄣ 提交于 2019-12-12 16:15:56
问题 I am writing Android functional tests. I need the device to be awake and the application to be visualized in order for them to work. I have consulted with Android developers for that. However, there are several problems with the proposed solution: The proposed method now has several deprecated methods. Android API now advises me to use flags on the window: This class was deprecated in API level 13. Use FLAG_DISMISS_KEYGUARD and/or FLAG_SHOW_WHEN_LOCKED instead; this allows you to seamlessly

Android UI automation test with appium

无人久伴 提交于 2019-12-12 14:31:22
问题 I just working on android UI automation test in few weeks. I tried with robotium in a time and now I want change to appium framework. And my question are: I read that appium is a test tool to test webview application. So how about the other app that is not webview app? Can I run test from appium on genymotion? Any other tool do I need to install with appium(selenium or something)? Edit When I try to install appium with out sudo I got this error ERR! Error: EACCES, unlink '/Users//appium/node

Testing across multiple activities with Espresso Null Pointer

半世苍凉 提交于 2019-12-12 14:02:09
问题 I am running a test that takes me in to another activity. When I get to that I need to wait for a dialog to disappear. public class StressTest extends ActivityInstrumentationTestCase2<DashboardActivity> { DashboardActivity activity; ConsoleActivity consoleActivity; public StressTest() { super(DashboardActivity.class); } public void setUp() throws Exception { super.setUp(); activity = getActivity(); } public void testRun() throws InterruptedException { schedule(); quickstart(); IP.enterIP(); <

Robolectric 3 GooglePlayServicesNotAvailableException

被刻印的时光 ゝ 提交于 2019-12-12 13:21:07
问题 I've just started to use Robolectric and wanted to know how to resolve Google Play Services . I'm using Robolectric 3 RC2 , and my gradle is as follow : build.bradle compile 'com.squareup.okhttp:okhttp:2.3.0' compile 'com.google.android.gms:play-services:7.0.0' testCompile ("org.robolectric:robolectric:3.0-rc2"){ exclude module: 'commons-logging' exclude module: 'httpclient' } testCompile ("org.robolectric:shadows-play-services:3.0-rc2"){ exclude module: 'commons-logging' exclude module:

Configuration change using Robolectric

限于喜欢 提交于 2019-12-12 11:07:30
问题 To retain my AsyncTasks across configuration changes, I use a fragment-based solution with setRetainInstance(true), which hosts each AsyncTask and calls back to a listening Activity, similar to this solution http://www.androiddesignpatterns.com/2013/04/retaining-objects-across-config-changes.html Ultimately, the purpose is to test the AsyncTask's retention functionality throughout configuration changes using Robolectric, but I need to start with setting up the actual configuration change

How to use mockableAndroidJar?

扶醉桌前 提交于 2019-12-12 10:53:16
问题 Now I am creating a unit test framework of our project using mockito or something else. I find there is a task app:mockableAndroidJar which can build a mockableAndroidJar jar file. What's it for? How to use it? I have not found introduction about it. 回答1: Several mock frameworks, including Mockito, work by overriding methods on the mocked or spied classes. However, the Android library uses a number of final classes and methods, which are more appropriate for compiling for embedded devices

Android Test Orchestrator not working with Android X

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 08:26:46
问题 I have recently migrated my project to use AndroidX, and have configured test orchestrator for my espresso tests on gradle using the following docs: https://developer.android.com/training/testing/junit-runner#using-android-test-orchestrator I have the dependency: androidTestUtil 'androidx.test:orchestrator:1.1.0-beta01' However, none of my tests are executed and looks like they fail when running gradle runs the following adb shell command i.e: adb shell 'CLASSPATH=$(pm path android.support

Espresso testing disable animation

假装没事ソ 提交于 2019-12-12 07:45:35
问题 @Test public void test3_PaySuccessful(){ init(); ViewInteraction amountEditText = onView( allOf(withId(R.id.et_amount), isDisplayed())); amountEditText.perform(replaceText("SGD 0.010"), closeSoftKeyboard()); //, withText("Proceed") ViewInteraction appCompatButton = onView( allOf(withId(R.id.btn_confirm), isDisplayed())); appCompatButton.perform(click()); //, withText("Pay") ViewInteraction appCompatButton2 = onView( allOf(withId(R.id.btn_confirm), isDisplayed())); appCompatButton2.perform

Reading an asset in a Xamarin NUnit test class

余生颓废 提交于 2019-12-12 05:30:09
问题 I want to read a mock RSS feed file to test against in a Xamarin NUnit test for an Android app. The test class has no context so I can't put the file in the Assets folder and do this: System.IO.Stream strIn = instanceOfAssetManager.Open(feedFile); It also has no ancestor, so I can't do this: System.IO.Stream strIn = this.Class.ClassLoader.ResourceAsStream(feedFile); Any suggestions how I can get to the jolly thing? This case solved a similar problem for a different platform/setup: Storing

How to use MonkeyRunner and Robotium together (not separately!)

不羁的心 提交于 2019-12-12 01:29:16
问题 How to use MonkeyRunner and Robotium together (not separately!) for testing my Android app 回答1: Well, I found this http://download.yandex.ru/company/experience/yac2012/kharitonenko_yac_2012.pdf slide #22. There is a scheme, how to use a combination of Robotium and Monkeyrunner. For example, when in your tests, you need to take a snapshot from Android native Camera, and Robotium can't do that. Monkeyrunner can do it. But most of your test case developed in Robotium, so as I understood, you can