2

I have a new app that is using Google Cloud Messaging (GCM) and therefore the new Google Play API.

Because the Google Play API does not run in an emulator only on a actual device I am so far unable to use my usual setup of maven, jenkins, sonar and emma to generate any code coverage.

To be more specific I can run instrumented tests and generate an emma.ec file but because the file is generated on device and not sdcard I cannot pull the file from the device with maven.

I believe I might be able to change the generated emma.ec location to the sdcard but I do no have one. Or root my phone and pull the file that way.

So my question is, does anyone know of another way to extract this file or otherwise work around these restrictions?

1 Answer 1

1

You don't actually want to test the coverage within the Google Play API but you want to test the coverage of your code that deals with the API so mocking makes sense here.

First you wrap the interaction with the Google Play API in a class of your own that just delegates calls to the Play API. Then you can mock out that service for your test so that it doesn't interact with the Google Play API but returns meaningful test data as though it were from the Google Play API. This way you can test your code that deals with success, failure, and edge cases.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.