How markrity/android-unit-test-example works
This is an Android unit-testing sample: a developer runs local JVM tests against app code, including code that uses Android framework APIs. The tree also shows examples for email validation and shared preferences. Source excerpts were not provided, so specific method calls and test-to-class mappings cannot be verified; the documented test workflow is shown without inventing those links.
Main entry points: EmailValidatorTest.java Email validator test · SharedPreferencesHelperTest.java Preferences helper test · EmailValidator.java Email validator · SharedPreferencesHelper.java Preferences helper
Components 7
Sample app
- Main activity
app/src/main/java/com/example/android/testing/unittesting/BasicSample/MainActivity.java - Email validator
app/src/main/java/com/example/android/testing/unittesting/BasicSample/EmailValidator.java - Preferences helper
app/src/main/java/com/example/android/testing/unittesting/BasicSample/SharedPreferencesHelper.java - Preference entry
app/src/main/java/com/example/android/testing/unittesting/BasicSample/SharedPreferenceEntry.java
Unit test examples
- Email validator test
app/src/test/java/com/example/android/testing/unittesting/BasicSample/EmailValidatorTest.java - Preferences helper test
app/src/test/java/com/example/android/testing/unittesting/BasicSample/SharedPreferencesHelperTest.java
Other components
- Developer
Connections 4
- Developer → Email validator test: runs locally
README.md - Developer → Preferences helper test: runs locally
README.md - Email validator test → Email validator: tests app code
README.md - Preferences helper test → Preferences helper: tests app code
README.md