Status Update
Comments
sp...@google.com <sp...@google.com>
sp...@google.com <sp...@google.com> #2
I am not sure I understand the use case. how can the benchmark be code to real world scenario when it's not possible to do right now ? which scenario is it ?
In any case, since this would be for benchmarking, this would clearly not be available through the public DSL. We should find a semi-private way of doing this (maybe the private variant API object could offer that functionality for instance or a property).
an...@google.com <an...@google.com> #3
We want benchmarks to measure code after Progaurd / R8, but it's not possible to turn that on for androidTests in library modules at the moment (to my knowledge?)
Benchmarks are also a public facing thing, but we have a plugin to help configure gradle builds for our users, so if support for this ends up in a private API, we could try to keep those usages localized to our code perhaps.
Description
In trying to sethttps://developer.android.com/training/testing/local-tests#error in agp-kmp I have found it does not prevent the reported test errors.
unitTests.returnDefaultValues = true
as perIn normal AGP, you set this on
UnitTestOptions
through aCommonExtension
. I believe in AGP-KMP, you are supposed to set this directly onKotlinMultiplatformAndroidTestOnJvm
. However, I have tried settingin both
build.gradle
andbuildSrc
(where I can watch it be applied in the debugger) and it doesn't appear to fix the issue.This problem is observed when applying the diff in this file to androidx, and running
:compose:runtime:runtime:testAndroidTestOnJvm
.My best guess is that
isReturnDefaultValues
is not propagating properly at some point? As mentioned in chat, there are apparently no tests for this case.Perhaps related is that , and privately in ?
returnDefaultValues
appears to be defined in two places, publicly in DSL inKotlinMultiplatformAndroidTestOnJvm
KmpUnitTestOptionsDslInfoImpl
The simplest workaround would normally be to add
robolectric
to theandroidUnitTest
sourceSet and tests in question, but in the case I've been looking at (compose-runtime
) several of the tests are defined at thecommon
level, and we can't add the robolectric test runner in a non-jvmcommon
sourceSet.