square / spoon

Distributing instrumentation tests to all your Androids.
https://square.github.io/spoon/
Apache License 2.0
2.7k stars 477 forks source link

Add clear app data before each test option #535

Closed rhomel closed 6 years ago

rhomel commented 6 years ago

I added a --clear-app-data CLI option that will run the pm clear command before each test run. This can be used to ensure each instrumentation test starts the app under test in a clean initial state.

rhomel commented 6 years ago

Thanks for the feedback. All requested changes implemented.

FYI I changed logging to Spoon's logger instead of the Android logger. When the clear command doesn't execute as expected (doesn't output "Success") a Spoon runner log message will be displayed.

rhomel commented 6 years ago

Feedback implemented!

edenman commented 6 years ago

Thanks @rhomel!

rhomel commented 6 years ago

Android Test Orchestrator was supposed to have this function but Google didn't actually implement it.

I just check and it was just recently added in 1.0.2-beta1. Maybe in the next SDK release we will have "official" access to it.

https://issuetracker.google.com/issues/77549481

On Tue, May 22, 2018 at 12:53 AM, Jason Atwood notifications@github.com wrote:

Maybe I'm missing something, but what does this give us that AndroidTestOrchestrator doesn't? https://developer.android.com/ training/testing/junit-runner#using-android-test-orchestrator

Also seems like these changes to how tests are run are outside Spoon's central goal "distributing instrumentation test execution and displaying the results in a meaningful way"

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/square/spoon/pull/535#issuecomment-390696514, or mute the thread https://github.com/notifications/unsubscribe-auth/ABIpCGZbo0ozWCYbyhT1vj0CEObW88AAks5t0uL0gaJpZM4T9eWf .

rhomel commented 6 years ago

Actually it looks like 1.0.2 is actually available, there's just no release notes yet...

On Tue, May 22, 2018 at 3:18 PM, Rhomel Chinsio rhomel.chinsio@gmail.com wrote:

Android Test Orchestrator was supposed to have this function but Google didn't actually implement it.

I just check and it was just recently added in 1.0.2-beta1. Maybe in the next SDK release we will have "official" access to it.

https://issuetracker.google.com/issues/77549481

On Tue, May 22, 2018 at 12:53 AM, Jason Atwood notifications@github.com wrote:

Maybe I'm missing something, but what does this give us that AndroidTestOrchestrator doesn't? https://developer.android.com/ training/testing/junit-runner#using-android-test-orchestrator

Also seems like these changes to how tests are run are outside Spoon's central goal "distributing instrumentation test execution and displaying the results in a meaningful way"

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/square/spoon/pull/535#issuecomment-390696514, or mute the thread https://github.com/notifications/unsubscribe-auth/ABIpCGZbo0ozWCYbyhT1vj0CEObW88AAks5t0uL0gaJpZM4T9eWf .