Skip to content
Find all test methods in an Android instrumentation APK
Kotlin Java Groovy
Branch: master
Clone or download
Drew Hannay
Latest commit 0d4956d Nov 5, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
buildSrc Prepare next development version. Nov 5, 2019
gradle/wrapper Initial code commit Feb 7, 2017
parser Add support for encoded array values (#43) Oct 31, 2019
test-app Add support for encoded array values (#43) Oct 31, 2019
.gitignore Add Android test project module (#6) Jul 11, 2017
.travis.yml Prepare for release 2.2.0 Nov 5, 2019
NOTICE Initial code commit Feb 7, 2017 Prepare next development version Aug 1, 2018
build.gradle Include annotations on test methods in output (#7) Jul 13, 2017
gradlew Initial code commit Feb 7, 2017
gradlew.bat Initial code commit Feb 7, 2017

Dex Test Parser

Build Status


dex-test-parser was inspired by the Google presentation "Going Green: Cleaning up the Toxic Mobile Environment".

What does it do?

Given an Android instrumentation apk, dex-test-parser will parse the apk's dex files and return the fully qualified method names of all JUnit 3 and JUnit 4 test methods.

Of course, you could also collect this list of method names from inside your test code by scanning the apk internally and using reflection. However, there are several reasons you may not want to do this:

  • Scanning the app's classpath for test methods at runtime causes any static initializers in the classes to be run immediately, which can lead to tests that behave differently than production code.
  • You might want to run one invocation of the adb shell am instrument command for each test to avoid shared state between tests and so that if one test crashes, other tests are still run.


Download the latest .jar via Maven:


or Gradle:

    compile 'com.linkedin.dextestparser:parser:2.2.0'

or you can manually download the jar from Bintray.

Getting Started

dex-test-parser provides a single public method that you can call from Java to get all test method names.

List<String> testMethodNames = DexParser.findTestNames(apkPath);

You can also use the jar directly from the command line if you prefer. This will create a file called AllTests.txt in the specified output directory.

java -jar parser.jar path/to/apk path/for/output

You can’t perform that action at this time.