Launch application without clearing the cache of an app

So I am launching an application using launch application keyword but whenever I am launching the application app cache is getting cleared automatically. I tried using noReset = True and fullReset = False in my appium capabilities but it is not working it seems. I think there is some issue with noreset and fullreset.

What I actually wants:

I have my first test case where I will launch an application then login into my app and then after then login is successful my first test case is completed.
Then I move to the next test case where I will launch the same application using launch application keyword. So my application should be logged in at that time but as now it is taking me to the login screen only.

Thanks in advance✌🏾

Launch application keeps the same settings as Open Application. So, If you use the Open Application as default (clearing the cache), Launch Application will do the same. Solution is to use Open Application with noReset set to true and then Launch Application will no longer clear the cache

2 Likes

Thanks @zastress. After trying so many time I got the same solution. But thank you so much the reply though. This is the correct solution :blush:

What I recommend you do for your setup is:

  • start first test case with open appplication and noReset=false
  • execute login and other steps
  • at the end of the test, close application and open it again with noReset=true.

This way, when test2 comes along with launch application it will no longer clear the cache. I have bren using this method successfully for quite some time

1 Like

Oh I guess that’ll be better. Thanks will do the same. I have one more question. And that is I have around 40-50 test cases in regression. So I’m planning to automate all of them. What would you recommend to do it one suite or multiple suite? So should I open application just once and then use launch and quit application?

It all depends on what you want to achieve. Using Launch Application instead of Open Application saves time.

how would the code look? Could you give an example or send code?

I’d always opt to keep suites specific to the app/area under tests, make use of tags too, and not mud them with different tests for different apps and areas, to that end… keep them separate where it makes sense and makes use of common resources where possible, but yeah you just want to make it as simplistic and as clean as possible, and what works best for you.

So in terms of the “around 40-50 test cases in regression”

If you’re looking at running multiple tests against a device currently connected, and you’re suites etc… are in check. If the application is already installed on the device, you can use the Activate Application keyword and pass the app_id, you could make use of tests / global variables to reduce duplication for different applications that you’d use throughout your tests by storing the app_id(s), which will make managing your code easier, and then once you’ve completed the test or if it fails is to then clean down the active application by the Stop Application keyword, using the same app_id.

In terms of your previous question, noRest=true this should work fine, without the need to handle it at the end, from past experiences if you were installing from an APK this would always reset it.

Providing a code snippet would be the most obvious way of potentially spotting any reasons to why it might not work as expected, but sounds as though you have a way around it :slight_smile: