Example Android project showcasing mutation testing set up with PIT and Robolectric
Java
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
gradle/wrapper
.gitignore
README.md
build.gradle
gradle.properties
gradlew
gradlew.bat
settings.gradle

README.md

Android Mutation Testing

An example Android project showcasing mutation testing set up with PIT and Robolectric.

This project is part of a blog post about mutation testing in Android on the Trifork blog.

UI

Imgur

The app consists of a single Activity with two SeekBars each representing an angle. A label text below displays the currently greatest angle.

Running unit tests

  1. Import this project in Android Studio.
  2. Create a new JUnit run configuration by selecting Run > Edit Configurations
  3. Click on the + sign and choose JUnit
  4. In the Name field write a name for your configuration (e.g. All unit tests).
  5. In the Test kind field select All in package
  6. In the Package field write the package name (e.g. com.trifork.ckp.androidmutationtesting).
  7. Click OK and run your new test configuration..

Running PIT mutation tests

pitest Gradle tasks will be created for each build variant. To run the task for all the variants (debug and release) type the following on the command line:

$ ./gradlew pitest

HTML reports will be placed in the /app/build/reports/pitest/ directory. For more information see the README for the gradle-pitest-plugin.

Libraries