Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/braisgabin/fragmenttestrule
JUnit Rule to test a Fragment in isolation
https://github.com/braisgabin/fragmenttestrule
android android-testing espresso junit-rule
Last synced: 8 days ago
JSON representation
JUnit Rule to test a Fragment in isolation
- Host: GitHub
- URL: https://github.com/braisgabin/fragmenttestrule
- Owner: BraisGabin
- License: apache-2.0
- Created: 2016-11-16T15:07:17.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-01-10T13:44:05.000Z (almost 6 years ago)
- Last Synced: 2024-10-31T23:24:58.241Z (15 days ago)
- Topics: android, android-testing, espresso, junit-rule
- Language: Java
- Homepage: https://engineering.21buttons.com/how-to-test-fragments-in-isolation-a7435a4cdc92
- Size: 176 KB
- Stars: 102
- Watchers: 5
- Forks: 16
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Fragment Test Rule
Test `Fragment`s in isolation.
## Download
```gradle
androidTestImplementation 'com.21buttons:fragment-test-rule:2.0.1'
debugImplementation 'com.21buttons:fragment-test-rule-extras:2.0.1'
```Note: If you don't support AndroidX yet use the version `1.1.0`.
## Usage
```java
@Rule
public FragmentTestRule, FragmentWithoutActivityDependency> fragmentTestRule =
FragmentTestRule.create(FragmentWithoutActivityDependency.class);@Test
public void clickButton() throws Exception {
onView(withText(R.string.button)).perform(click());onView(withText(R.string.button_clicked)).check(matches(isDisplayed()));
}
```You can check the sample code for more examples.