Obsolete
Status Update
Comments
yb...@google.com <yb...@google.com> #2
This is a regression in the test support library 1.0 / Espresso 3.0.0. The issue does not occur if using the previous version of the testing support library 0.5, Espresso 2.2.2 or Espresso 2.3-alpha
yb...@google.com <yb...@google.com>
cu...@gmail.com <cu...@gmail.com> #3
The ClassNotFoundException is being reported because the class could not be loaded because its base class could not be found. That behavior is correct if the class name has been explicitly specified. However, if the class name was obtained by scanning the path (which I assume is what is happening in this case) then it should ignore class loading errors.
Can you confirm that the test from step 2 is actually run even though a test failure is being reported for the unloadable class?
Can you confirm that the test from step 2 is actually run even though a test failure is being reported for the unloadable class?
cu...@gmail.com <cu...@gmail.com> #4
The test cases are not being run. To prevent runtime crashes, I have the test cases which touch newer APIs configured with @SdkSuppress. The problem is occurring because the new runner is scanning the classpath and blows up whenever it sees something missing.
The same problem will occur with optional dependencies, like how Google Play Services contains MapFragment but the POM doesn't declare a dependency on support-v4. Clients of play services are expected to either not touch MapFragment or include support-v4 before touching the class. I do something similar with one of my own libraries, and anything consuming that library will fail to run tests unless I include an `androidTestCompile` dependency on support-v4.
The same problem will occur with optional dependencies, like how Google Play Services contains MapFragment but the POM doesn't declare a dependency on support-v4. Clients of play services are expected to either not touch MapFragment or include support-v4 before touching the class. I do something similar with one of my own libraries, and anything consuming that library will fail to run tests unless I include an `androidTestCompile` dependency on support-v4.
cu...@gmail.com <cu...@gmail.com> #5
I do not understand how the presence of one unloadable class is preventing other tests from being run. The code in TestLoader is explicitly written to detect this situation and defer the reporting of the error until the tests are run so that one unloadable class does not prevent the tests from running.
Could you provide the device side logs from your test run please?
Could you provide the device side logs from your test run please?
yb...@google.com <yb...@google.com> #6
pa@google.com, another issue closed as duplicate https://issuetracker.google.com/issues/64094195 has logs attached as well as this issue (in the description).
Btw, the workaround for that is to limit scope of the search for the test runner — pass package that contains only tests:
- Either by specifying package by passing instrumentation arguments -e package com.example.tests
- Or by subclassing AndroidJUnitRunner and overriding onCreate and adding package parameter there
Btw, the workaround for that is to limit scope of the search for the test runner — pass package that contains only tests:
- Either by specifying package by passing instrumentation arguments -e package com.example.tests
- Or by subclassing AndroidJUnitRunner and overriding onCreate and adding package parameter there
cu...@gmail.com <cu...@gmail.com> #7
The bug referenced in #6 only contains a stacktrace not a full log. Working around it by using package name filtering makes sense because that will remove the name of the unloadable class before it is tried to be loaded.
[Deleted User] <[Deleted User]> #8
Fixed in the next release, Runner v1.0.1
Description
Version used: 1.0.0-alpha3
Devices/Android versions reproduced on: Compile time
Define basic Entity:
import android.arch.persistence.room.Entity;
import android.arch.persistence.room.PrimaryKey;
@Entity
public class MyEntity {
@PrimaryKey
public String bestDataInTheWorld;
public MyEntity(@NonNull String bestDataInTheWorld) {
this.bestDataInTheWorld = bestDataInTheWorld;
}
}
Compile error
error: Entities and Pojos must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type).
Tried the following constructors but they failed to match:
MyEntity(java.lang.String) : [arg0 : null]
error: Entities and Pojos must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type).
It works if I remove @NonNull annotation.