{"id":13770520,"url":"https://github.com/novoda/rxpresso","last_synced_at":"2025-05-11T03:32:46.853Z","repository":{"id":32033626,"uuid":"35604995","full_name":"novoda/rxpresso","owner":"novoda","description":"Easy Espresso UI testing for Android applications using RxJava.","archived":true,"fork":false,"pushed_at":"2018-02-02T14:14:07.000Z","size":128,"stargazers_count":363,"open_issues_count":0,"forks_count":23,"subscribers_count":60,"default_branch":"master","last_synced_at":"2024-11-17T06:40:23.173Z","etag":null,"topics":["android","android-application","espresso-tests","novoda","open-source","rxjava","rxpresso"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/novoda.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-14T10:18:48.000Z","updated_at":"2023-10-01T16:47:38.000Z","dependencies_parsed_at":"2022-08-24T14:22:58.660Z","dependency_job_id":null,"html_url":"https://github.com/novoda/rxpresso","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novoda%2Frxpresso","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novoda%2Frxpresso/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novoda%2Frxpresso/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novoda%2Frxpresso/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/novoda","download_url":"https://codeload.github.com/novoda/rxpresso/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253514352,"owners_count":21920327,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-application","espresso-tests","novoda","open-source","rxjava","rxpresso"],"created_at":"2024-08-03T17:00:38.697Z","updated_at":"2025-05-11T03:32:46.232Z","avatar_url":"https://github.com/novoda.png","language":"Java","funding_links":[],"categories":["Testing","Integration Test"],"sub_categories":["Library"],"readme":"# UNMAINTAINED\n\nNo maintainance is intended.\n\n# RxPresso [![CI status](https://ci.novoda.com/buildStatus/icon?job=rxpresso)](https://ci.novoda.com/job/rxpresso/lastBuild/console) [![Download from Bintray](https://api.bintray.com/packages/novoda/maven/rxpresso/images/download.svg)](https://bintray.com/novoda/maven/rxpresso/_latestVersion) [![Apache 2.0 Licence](https://img.shields.io/github/license/novoda/rxpresso.svg)](https://github.com/novoda/rxpresso/blob/master/LICENSE.txt)\n\nEasy Espresso UI testing for Android applications using RxJava.\n\n## Description\n\nRxPresso makes testing your presentation layer using RxJava as easy as a Unit test.\n\nRxPresso uses [Mockito](http://mockito.org/) to generate mocks of your repositories that you can use with RxPresso to control data in your Espresso tests.\nThe binding with Espresso Idling resource is handled for you so Espresso will wait until the data you expect to inject in your UI\nhas been delivered to you UI.\n\nNo more data you don't control in your Espresso test.\n\nThis project is in its early stages, feel free to comment, and contribute back to help us improve it.\n\n## Adding to your project\n\nTo integrate RxPresso into your project, add the following at the beginning of the `build.gradle` of your project:\n\n```groovy\nbuildscript {\n    repositories {\n        jcenter()\n    }\n    dependencies {\n        androidTestCompile 'com.novoda:rxpresso:0.2.0'\n    }\n}\n```\n\n\n## Simple usage\n\nTo generate a mocked repo simply use Mockito.\n\n**Example repository**\n```java\npublic interface DataRepository {\n\n    Observable\u003cUser\u003e getUser(String id);\n\n    Observable\u003cArticles\u003e getArticles();\n\n}\n```\n\n**Mocking this repository**\n```java\nDataRepository mockedRepo = Mockito.mock(DataRepository.class)\n```\n\nYou should then replace the repository used by your activities by this mocked one.\nIf you use Dagger or Dagger2 you can replace the module by a test one providing the mock.\nIf your repo lives in the application class you can have a setter or user reflection to set it during tests.\nAny other option as long as your UI reads from the mocked repo.\n\n**Set up RxPresso in your tests**\n```java\nDataRepository mockedRepo = getSameRepoUsedByUi();\n\nRxPresso rxpresso = RxPresso.from(mockedRepo);\nEspresso.registerIdlingResources(rxPresso);\n```\n\n**Use it to inject data in your UI**\n```java\nrxPresso.given(mockedRepo.getUser(\"id\"))\n           .withEventsFrom(Observable.just(new User(\"some name\")))\n           .expect(any(User.class))\n           .thenOnView(withText(\"some name\"))\n           .perform(click());\n```\n\n**Use it to inject data from local sources**\n```java\nObservable\u003cUser\u003e testAssetObservable = testAssetRepo.getUser(\"id\");\n\nrxPresso.given(mockedRepo.getUser(\"id\"))\n           .withEventsFrom(testAssetObservable)\n           .expect(any(User.class))\n           .thenOnView(withText(\"some name\"))\n           .perform(click());\n```\n\n**Use custom matchers**\n```java\nObservable\u003cUser\u003e testAssetObservable = testAssetRepo.getUser(\"id\");\n\nrxPresso.given(mockedRepo.getUser(\"id\"))\n           .withEventsFrom(testAssetObservable)\n           .expect(new RxMatcher\u003cNotification\u003cUser\u003e\u003e() {\n                   @Override\n                   public boolean matches(Notification\u003cUser\u003e actual) {\n                       return actual.getValue().name().equals(\"some name\");\n                   }\n\n                   @Override\n                   public String description() {\n                       return \"User with name \" + \"some name\";\n                   }\n           })\n           .thenOnView(withText(\"some name\"))\n           .perform(click());\n```\n\n**Use it to inject errors in your UI**\n```java\nrxPresso.given(mockedRepo.getUser(\"id\"))\n           .withEventsFrom(Observable.error(new CustomError()))\n           .expect(anyError(User.class, CustomError.class))\n           .thenOnView(withText(\"Custom Error Message\"))\n           .matches(isDisplayed());\n```\n\n**Reset mocks between tests**\n```java\nrxPresso.resetMocks();\n```\n\nYou can also use RxPresso with multiple repositories.\nJust setup using all the repositories your UI is using.\nThe usage doesn't change RxPresso will detect from what repo the observable provided comes from and send the data to the correct pipeline.\n\n**Setup with multiple repositories**\n```java\nDataRepository mockedRepo = getSameRepoUsedByUi();\nAnotherDataRepository mockedRepo2 = getSameSecondRepoUsedByUi();\n\n\nRxPresso rxpresso = RxPresso.from(mockedRepo, mockedRepo2);\nEspresso.registerIdlingResources(rxPresso);\n```\n\n## Links\n\nHere are a list of useful links:\n\n * We always welcome people to contribute new features or bug fixes, [here is how](https://github.com/novoda/novoda/blob/master/CONTRIBUTING.md)\n * If you have a problem check the [Issues Page](https://github.com/novoda/rxpresso/issues) first to see if we are working on it\n * Looking for community help, browse the already asked [Stack Overflow Questions](http://stackoverflow.com/questions/tagged/support-rxpresso) or use the tag: `support-rxpresso` when posting a new question\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnovoda%2Frxpresso","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnovoda%2Frxpresso","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnovoda%2Frxpresso/lists"}