How to automate upgrade testing for android

By : Sugre

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/;

#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/;

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


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

adb uninstall 
By : testsingh

This video can help you solving your question :)
By: admin