code coverage - Android JUnit: Define a different Application subclass -


so normal android project, have following in androidmanifest.xml:

<application android:name=".utilities.app" ...>      .... </application> 

and have app class:

public class app extends application {      .... } 

and have android junit test project associated android project. fine , dandy , can write junit tests. however, i'm trying run code coverage junit tests , i'm getting bloated results. reason because app class gets called , initialized if application started. not want custom app class execute when run junit tests or code coverage. setup need junit tests go in appropriate junit setup() method. there way can prevent executing custom app class or way classes/methods/lines executed due creation of app class aren't counted towards code coverage?

a temporary solution i've found work unless has better ideas.

  • go main android project's androidmanifest.xml.
  • change android:name attribute ".utilities.app" "android.app.application"
  • run code coverage utility/junit tests
  • change android:name attribute "android.app.application" ".utilities.app"
  • re-deploy app onto device (so uses right application class when runs external code coverage/junit tests)

i'm sure real solution automate process, i'm lazy so, , feels hackish , wrong. @ least it's workaround unless has ideas.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -