-
Notifications
You must be signed in to change notification settings - Fork 56
Tests in Android Studio IntellJ
nenick edited this page May 2, 2014
·
22 revisions
Unit and component test will need different classpath with an entry to compiled test classes.
- Start a test and you will get error like:
/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/bin/java ...
Class not found: "com.example.activities.MainActivityTest"
Process finished with exit code 1
- From the first line copy the -classpath "..." part to an editor
- Append missing class and resource locations at end of classpath
- absolute-path-to-test-module/build/resources/testDebug
- absolute-path-to-test-module/build/test-classes/debug
- Edit your run configuration
- VM options: Paste here your modified classpath
- Working directory:
$MODULE_DIR$ - Before launch -> Add -> Run External Tool -> Add
- Program: ../gradlew
- Parameters: processTestDebugResources testDebugClasses
- Working directory:
$ModuleFileDir$
Finish, now your test should run. This must be repeated when classpath changes occur (e.g add new dependency).
since long time not more seen
!!! JUnit version 3.8 or later expected: java.lang.RuntimeException: Stub!
```
When it occur, make the junit4 classpath entry as the first entry in that classpath.