Obsolete
Status Update
Comments
mi...@azimo.com <mi...@azimo.com> #2
Tried on AS 3.1 and 3.2
uc...@google.com <uc...@google.com> #3
Reproduced in
Android Studio 3.1.3
Build #AI-173.4819257, built on June 4, 2018
JRE: 1.8.0_152-release-1024-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.9.0-6-amd64
Android Studio 3.1.3
Build #AI-173.4819257, built on June 4, 2018
JRE: 1.8.0_152-release-1024-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.9.0-6-amd64
da...@shopify.com <da...@shopify.com> #4
From https://issuetracker.google.com/issues/111154138
Steps to reproduce:
1. Launch Android Studio and select "Start a new Android Studio project"
2. Accept all the defaults, except "Include Kotlin support" and "Add No Activity"
3. "Finish" to create a new "app"
4. Navigate to the `com.example.name.myapplication` package under (test)
5. Right-click on the package and select "run tests in 'myapplication'"
Results:
No tests were found
Note: If you select the _class_ the tests run correctly.
Steps to reproduce:
1. Launch Android Studio and select "Start a new Android Studio project"
2. Accept all the defaults, except "Include Kotlin support" and "Add No Activity"
3. "Finish" to create a new "app"
4. Navigate to the `com.example.name.myapplication` package under (test)
5. Right-click on the package and select "run tests in 'myapplication'"
Results:
No tests were found
Note: If you select the _class_ the tests run correctly.
le...@google.com <le...@google.com> #5
@John / Jedo, is that something you guys could help take a look at?
je...@google.com <je...@google.com> #6
seems like the work need to start in the IDE.
rp...@google.com <rp...@google.com> #7
This is more or less "Work as Intended". The underlying problem is that the dependency goes from the dynamic feature modules(s) to the base(app) module. So, when selecting "app" and its dependencies in the run configuration, no dynamic features is discovered, because "app" does not depend on dynamic feature module(s). If a dynamic feature module is specified in the "Use classpath of module:" drop down, then unit test for that specific dynamic feature module *and* the main app module will be run. There is no way however to select more than one dynamic feature module.
The only workaround that ensures everything is run is to use the "Search for test: In whole project" option.
The only workaround that ensures everything is run is to use the "Search for test: In whole project" option.
rp...@google.com <rp...@google.com> #8
#1: I am observing slightly behavior with Android Studio 3.2 Beta 4. The bug report says you are using Android Studio 3.1.3 with the Gradle Plugin 3.2.0-beta01. Are you using dynamic features or instant app features? (Android Studio 3.1.3 does not support dynamic features).
mi...@azimo.com <mi...@azimo.com> #9
Tried on Android Studio 3.2 beta 5 and gradle:3.2.0-beta05. No dynamic features nor instant apps (I downloaded my example project: https://github.com/frogermcs/MultiModuleGithubClient )
Tried config:
Test kind: all in package
Search in whole project
Working directory: /app
JRE: Android API 27
Got:
!!! JUnit version 3.8 or later expected:
java.lang.RuntimeException: Stub!
at junit.runner.BaseTestRunner.<init>(BaseTestRunner.java:5)
at junit.textui.TestRunner.<init>(TestRunner.java:54)
at junit.textui.TestRunner.<init>(TestRunner.java:48)
at junit.textui.TestRunner.<init>(TestRunner.java:41)
at com.intellij.rt.execution.junit.JUnitStarter.junitVersionChecks(JUnitStarter.java:224)
at com.intellij.rt.execution.junit.JUnitStarter.canWorkWithJUnitVersion(JUnitStarter.java:207)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:61)
When I change JRE to Default <No JRE - module not specified>, I get:
java.lang.NoClassDefFoundError: android/app/Activity
at java.lang.ClassLoader.defineClass1(Native Method)
....
But at least all tests are listed in tests tree.
---
When I change the working directory to %MODULE_DIR%, JRE Default <No JRE> i get:
Process finished with exit code 1
Class not found: "com.frogermcs.multimodulegithubclient.SplashActivityPresenterTest"
Tried config:
Test kind: all in package
Search in whole project
Working directory: /app
JRE: Android API 27
Got:
!!! JUnit version 3.8 or later expected:
java.lang.RuntimeException: Stub!
at junit.runner.BaseTestRunner.<init>(BaseTestRunner.java:5)
at junit.textui.TestRunner.<init>(TestRunner.java:54)
at junit.textui.TestRunner.<init>(TestRunner.java:48)
at junit.textui.TestRunner.<init>(TestRunner.java:41)
at com.intellij.rt.execution.junit.JUnitStarter.junitVersionChecks(JUnitStarter.java:224)
at com.intellij.rt.execution.junit.JUnitStarter.canWorkWithJUnitVersion(JUnitStarter.java:207)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:61)
When I change JRE to Default <No JRE - module not specified>, I get:
java.lang.NoClassDefFoundError: android/app/Activity
at java.lang.ClassLoader.defineClass1(Native Method)
....
But at least all tests are listed in tests tree.
---
When I change the working directory to %MODULE_DIR%, JRE Default <No JRE> i get:
Process finished with exit code 1
Class not found: "com.frogermcs.multimodulegithubclient.SplashActivityPresenterTest"
sa...@google.com <sa...@google.com>
ch...@google.com <ch...@google.com> #10
I tried on AS 3.2.1 with https://github.com/frogermcs/MultiModuleGithubClient
It looks like Android API 27 Platform doesn't work. So I tried other configurations:
Config1
Test kind: all in package
Search in whole project
Working directory: $MODULE_DIR$
JRE: Default
It works.
=========
Config2
Test kind: all in package
Search in whole project
Working directory: [path/to/project]/app
JRE: Android API 28 Platform
This works as well.
Since there are workable test configurations I'd like to close this bug.
Thanks!
It looks like Android API 27 Platform doesn't work. So I tried other configurations:
Config1
Test kind: all in package
Search in whole project
Working directory: $MODULE_DIR$
JRE: Default
It works.
=========
Config2
Test kind: all in package
Search in whole project
Working directory: [path/to/project]/app
JRE: Android API 28 Platform
This works as well.
Since there are workable test configurations I'd like to close this bug.
Thanks!
Description
If app is composed from modules (e.g. app + base + feature1 + feature2), it is not possible to launch unit tests at once for all of them.
Steps to reproduce:
1) App has multiple modules, each mode has its own unit tests. Fresh start (no code was generated yet)
2) Run Configuration:
- Android JUnit
- Test kind: All in package
- Search for tests: Across module dependencies
- Working directory: %MODULE_DIR%
- Use classpath of module: app (main app module)
- Before launch: Gradle-aware make (tried with gradle buildDebug too)
3) Run it.
Results:
Android Studio reports that it couldn't find unit tests in depending modules (e.g. Class not found... or No tests in given module). Seems like some code isn't generated in modules build/intermediates.
Expected results:
All tests launched.
Workaround:
Run unit tests for each of modules separately, then launch created Run Configuration from 2). All tests are launched correctly.
Build: 3.1.3, AI-173.4819257, 201806041730,
AI-173.4819257, JRE 1.8.0_152-release-1024-b01x64 JetBrains s.r.o, OS Mac OS X(x86_64) v10.13.4 unknown, screens 1680x1050, 1920x1200, 1920x1200
Android Gradle Plugin: 3.2.0-beta01
Gradle: 4.6
NDK: from local.properties: (not specified); latest from SDK: (not found);
LLDB: pinned revision 3.1 not found; latest from SDK: (package not found);
CMake: from local.properties: (not specified); latest from SDK: (not found); from PATH: (not found);
IMPORTANT: Please read