How to automate upgrade testing for android

We have been using espresso for android automation, and that includes upgrade testing

For upgrade testing, we need to perform 3 steps:

  • Failed to crunch file - Android studio (app:mergeDebugResources)
  • Filter output in logcat by tagname
  • Cross compiling GCC with newlib for ARM: how to specify GCC options like -march?
  • open google maps app from a browser with default start location on android and iphone
  • Passing arguments to AsyncTask, and returning results
  • How to call getWindow() outside an Activity in Android?
    1. Make some actions in the old version to prepare some data
    2. Upgrade to new version (cover install)
    3. Check the data saved in old version is correctly preserved and no other issue after upgrading.

    Currently we are doing it in a very clumsy way:

    #Before: prepare data on old version
    adb -s $DEVICE shell am instrument -e class com.example.test.upgrade.UpgradeTest#prepareDataIn${version} -w com.example.test/com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner;
    
    #install new version
    adb -s $DEVICE install -r new_version.apk;
    
    #After: test after upgrading
    adb -s $DEVICE shell am instrument -e class com.example.test.upgrade.UpgradeTest#testUpgradeFrom${version} -w com.example.test/com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner;
    

    We break the upgrade test from a certain version into before/after 2 parts, because we don’t know if we are able (and how) to install the new version inside a test.

    But, this 3 step test by adb command just looks stupid, and we can’t get a junit report easily.

    So does anyone knows a better easy way to carry out android upgrade testing, or could you point out what we are doing wrong?

    It’s not limited to Espresso, if you are working with other framework, how do you make upgrade test with it?

    Thanks in advance.

    Related posts:

    Why was HTML5 Web Workers support removed from the Android browser in versions 2.2 and up?
    onServiceDisconnected() not called after calling Service stopSelf()
    Mobile Vision API - concatenate new detector object to continue frame processing
    Android RecyclerView + CursorLoader + ContentProvider + “Load More”
    Android add arrow image to spinner
    Launch Location Settings intent from preferences XML file
  • How to find and collect all the information available in a give contact in any android phone?
  • What is use of android:supportsRtl=“true” in AndroidManifest xml file
  • How do I handle exceptions in map() in an Observable in RxJava
  • Running Android Lint has encountered a… Failed. java.lang.NullPointerException
  • Accessing GoogleApiClient object in All Activities
  • AsyncTask: doInBackground not called
  • One Solution collect form web for “How to automate upgrade testing for android”

    You can uninstall the existing package from the device if you are sure you got the latest one:

    adb uninstall <your-package-name>
    

    then you can just install and run tests with latest apk install.

    Other way is to use Gradle, which will always check if there is any code change since the previous build, it will then uninstall and reinstall the latest one, are you not using gradle to build and run your tests?

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.