android-espresso

Testing RxJava2 using Espresso and getting a null pointer exception when suscribeOn

时间秒杀一切 提交于 2019-12-23 07:24:50
问题 Android Studio 3.0 Beta2 I am testing getting a list for an endpoint using RxJava2. The app works fine when running normally. However, when I test using espresso I get a null pointer exception when I try and subscribeOn(scheduler) . For the schedulers I use the trampoline() for both subscribeOn and observeOn which are injected. Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'io.reactivex.Observable io.reactivex.Observable.subscribeOn(io.reactivex.Scheduler)' on a

Espresso.pressBack() does not call onBackPressed()

女生的网名这么多〃 提交于 2019-12-23 06:56:09
问题 In Espresso class: @Rule public IntentsTestRule<MainActivity> mIntentsRule = new IntentsTestRule<>( MainActivity.class); @Test public void test_backButton(){ onView(withId(R.id.NEXT_ACTIVITY)).perform(scrollTo(), click()); Espresso.pressBack(); } In Activity: @Override public void onBackPressed() { Log.d("TEST_pressBack", "inside onBackPressed()"); do_something(); super.onBackPressed(); } @Override public void finish() { Log.d("TEST_pressBack", "inside finish()"); super.finish(); } When I

@BeforeClass and @AfterClass called before and after each test

可紊 提交于 2019-12-23 04:33:30
问题 I have a very simple test class for running espresso tests on Android that looks like this: import android.util.Log; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; import org.junit.rules.ExternalResource; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import java.io.IOException; @RunWith(JUnit4.class) public class Wtf { private static class TestResources extends

Espresso testing android

旧街凉风 提交于 2019-12-23 01:51:11
问题 I run the tests in Android Studio, running task - "test". My test failed, my html report detailed: junit.framework.AssertionFailedError: Class Test has no public constructor TestCase(String name) or TestCase() at junit.framework.Assert.fail(Assert.java:57) at junit.framework.TestCase.fail(TestCase.java:227) at junit.framework.TestSuite$1.runTest(TestSuite.java:100) at junit.framework.TestCase.runBare(TestCase.java:141) at junit.framework.TestResult$1.protect(TestResult.java:122) at junit

Running tests using gradle or inside android studio result in NoClassDefFoundError

别来无恙 提交于 2019-12-22 12:30:54
问题 I know that asking this type of question without specifics is very difficult, however; the project that is having the problem is proprietary and I have not been able to reproduce the issue in any other project. So I've added the following to my build.gradle file: androidTestCompile('com.jakewharton.espresso:espresso:1.1-r3') { exclude group: 'com.square.dagger' } androidTestCompile('com.jakewharton.espresso:espresso-support-v4:1.1-r3') { exclude group: 'com.android.support' } I do have two

More than one file was found with OS independent path 'protobuf.meta'

回眸只為那壹抹淺笑 提交于 2019-12-22 08:24:23
问题 I'm seeing some issues with compatibility between com.google.android.gms:play-services-auth:11.6.0 and com.android.support.test.espresso:espresso-core:3.0.1 when used as dependencies on an android library module I'm getting this error: Execution failed for task ':mylibrary:transformResourcesWithMergeJavaResForDebugAndroidTest'. More than one file was found with OS independent path 'protobuf.meta' when I try to execute ./gradlew :myLibrary:connectedAndroidTest Here's a barebones build.gradle

onWebView No views in hierarchy found matching: WebView with JS enabled

*爱你&永不变心* 提交于 2019-12-22 05:45:08
问题 I am trying some basic webView testing: public class TheMainActivity { @Rule public ActivityTestRule<MainActivity> activityTestRule = new ActivityTestRule<MainActivity>(MainActivity.class, false, false) { @Override protected void afterActivityLaunched() { onWebView().forceJavascriptEnabled(); } }; @Test public void theIntroductionShouldShow() { activityTestRule.launchActivity(null); onWebView().check(webMatches(getText(), containsString("SURVIVAL ACTIONS"))); } } regarding to this

Android test coverage report for multi module app

别来无恙 提交于 2019-12-22 05:20:25
问题 We have a multi module application. Where we have 3 library projects and 1 launch project. module1 (Libraray) module2 (Libraray) depends on module1 module3 (Libraray)depends on module1 Launch (Does not have any source code its just a launcher for all lib)depends on module1 and module 2. In module1 we are accessing module 2 and module 3 classes using facade pattern. Due to that we need to write all the test cases in Launch project as we have access the to all the classes in launch project so

Espresso. Error performing 'load adapter data'

ぐ巨炮叔叔 提交于 2019-12-22 01:56:16
问题 I have a ListView, which shows data from a database. db = new DB(this); db.open(); String[] from = new String[]{DB.COLUMN_FIRSTNAME, DB.COLUMN_LASTNAME}; int[] to = new int[]{android.R.id.text1, android.R.id.text2}; scAdapter = new SimpleCursorAdapter(this, android.R.layout.simple_list_item_activated_2, null, from, to, 0); lvData = (ListView) findViewById(R.id.lvData); lvData.setAdapter(scAdapter); lvData.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); lvData.setMultiChoiceModeListener

Flaky Android Espresso Test - Snackbar

自闭症网瘾萝莉.ら 提交于 2019-12-22 01:53:55
问题 1) All devices/emulators being tested have animations disabled. 2) I have an @BeforeClass which builds my Credentials object. 3) I have an IntenServiceIdlingResource and an EventBusIdlingResource, registered in @Before. 4) When the sign in button is clicked, the IntentService fires off. In this case, the server (a mocked server) is returning a 500 error. That information is posted back to the UI from the IntentService, via greenrobot's EventBus, and a Snackbar is shown with the error message.