https://kotlinlang.org logo
#compose
Title
# compose
v

Vinay Gaba

06/08/2020, 12:29 AM
Another question - I’m using
AndroidComposeTestRule
to start a custom activity to test it. The individuals tests work fine but they fail when running them together. This is because I’m not doing anything in the
@Before
method to clean and restart the activity. That causes the state to be shared between the test cases. I know in Espresso I’ve used a custom test rule for avoiding this. Can I get any direction on whether something like that already exists in compose?
For anyone else curious, there was nothing compose specific needed to solve this. I just had to use a flag in the Android Test Orchestrator
Copy code
testInstrumentationRunnerArguments clearPackageData: 'true'
More details here - https://developer.android.com/training/testing/junit-runner
4 Views