This Question have 1 answers right now.

How to automate upgrade testing for android

By : Sugre
Source: Stackoverflow.com
Question!

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

For upgrade testing, we need to perform 3 steps:

  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.

By : Sugre


Answers

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

adb uninstall 
By : testsingh


Video about How to automate upgrade testing for android