New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document configuration for AGP to unit test Molecule #114
Comments
You need to set android {
testOptions {
unitTests.returnDefaultValues = true
}
} per that link. This requirement comes from Compose itself, and not anything this library is doing. All usages of Compose in Android unit tests will require this be set. |
@JakeWharton Got it! That link in the error log wasn't opening on my end. Sorry for the trouble. |
Oh, you're right. I'll file a bug on AGP for that. |
We can also probably add this to our docs. |
Upstream bug about exception message: https://issuetracker.google.com/issues/246752914 |
I'm trying out Molecule with AAC ViewModel. Here is how the VM code is written exposing stateFlow stream using
launchMolecule()
Molecule version used :
0.5.0-SNAPSHOT
App works fine on Android devices without any issue when VM is provided with correct coroutineScope and frameClock. However, when I write Unit test for VM it requires
android.os.Trace
to be mocked. Added both unit test and it's error log below.VM's Unit Test
Test Error log
I'm sure i'm doing something stupid here because unit tests written in
sample
app of this repo works just fine without any such error.Questions:
Repo to reproduce it : https://github.com/punitda/Tinysplash
Thanks!
The text was updated successfully, but these errors were encountered: