Difference between noReset and fullReset?

What is the difference? When I specify fullReset=true and noReset=false capabilities my app gets installed when I instantiate the driver, but then a closeApp call closes the simulator, restarts it, and REINSTALLS the app!

When I specify fullReset=true and noReset=true the app DOES NOT get installed when I instantiate the driver.

Note that in all cases I do not provide any “resetting” options when starting the server. The only one I use that MAY have an effect is --session-override

I need the following:

Instantiating the driver installs the app
The freedom to at any time close and re-open the app WITHOUT re-installing the app

Please, how can I do that? If anyone else is doing that (and I suspect there are thousands of you) I would love to see how you do it, step-by step, in desired capabilities and when starting the server

Hi.

You can not uninstall tested app in iOS inside test but only on test start. With android you can try this.

        if (devicePlatform.contains("fullReset")) { // uninstall and install client
            System.out.println("  Driver DO FULL-RESET");
            capabilities.setCapability(MobileCapabilityType.FULL_RESET, true);
            capabilities.setCapability(MobileCapabilityType.NO_RESET, false);
        } else if (devicePlatform.contains("fastReset")) { // clears cache and settings without reinstall
            System.out.println("  Driver DO FAST-RESET");
            capabilities.setCapability(MobileCapabilityType.FULL_RESET, false);
            capabilities.setCapability(MobileCapabilityType.NO_RESET, false);
        } else { // just start client
            System.out.println("  Driver DO NORMAL start"); 
            capabilities.setCapability(MobileCapabilityType.FULL_RESET, false);
            capabilities.setCapability(MobileCapabilityType.NO_RESET, true);
        }

Still, what is the difference between fullReset and noReset, The names of these methods are beyond confusing, so can someone please tell me what these are supposed to do?

noReset just clears the app data, such as its cache.

fullRest uninstalls the app. fullReset is generally used when you have newer versions of the app coming in fairly quickly. So with fullReset, you will always uninstall the app and then automatically install the new version.

Link with details on noReset & fullReset - https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md

3 Likes

Thank you, that helps!

@Aleksei

Hi,

I want to clear my app(IOS) cache so I provided the below capabilities:

i tried:
cap.setCapability(MobileCapabilityType.NO_RESET, “false”);
cap.setCapability(MobileCapabilityType.FULL_RESET,“false”);

But it’s not clearing the cache, I am trying below case:

Steps:

  1. I am starting my test script 1st time,adding item to cart next step is login and then checkout and then driver.quit()
  2. Now am starting my same script 2nd time, it’s skipping the login step
    add to cart and then checkout is coming directly because as I already logged in 1st time in the the app, Now 2nd time also I want same steps as I did 1st time that is add to cart login checkout and then driver.quit()
    but 2nd time its doing add to cart checkout, but not going to login

Can you please advice me how I can resolve this?

Regards,
Sanjay

@Sanjay_Sharma there are some problematic settings that do not delete and appium deleting app data in simulator (maybe phone also - just never tried) . and we need to use “fullReset” example.

for example with our client some settings got deleted but some are remain. so i divided tests into 3 main parts:

  • need fullRest (minor part of tests - 9 now). slow test start up to 1min depending on client size also.
  • fastReset (about 15-20 tests). faster start time
  • noReset (all other most of tests). fastest start time of 10sec about with mine machine.

If cap.setCapability(MobileCapabilityType.FULL_RESET,“True”);

It will rest the app and clear the app data

If cap.setCapability(MobileCapabilityType.NO_RESET, “True”);

It will not reset and app will be same as it ended on first run

Hi everyone

I am also facing similar type of problem. My android capabilities are:

config.capabilities = [
{
platformName: ‘Android’,
noReset: false, // on Android will keep your app cache saved and with new Appium session there will be no need to log in again.
fullReset: true, // uninstall the app after test
maxInstances: 1,
automationName: ‘uiautomator2’,
deviceName: AndroidInfo.deviceName(),
platformVersion: AndroidInfo.platFormVersion(),
app: AndroidInfo.appName(),
chromedriverExecutable: ‘/integration-tests/node_modules/chromedriver/lib/chromedriver/chromedriver’,

},

];

When:
noReset: false, fullReset: true: It clears the cache and UNINSTALL the app.
noReset: true, fullReset: false: It does not clear the cache properly and for me this combination is not working as expected in automation.
noReset: true, fullReset: true: It failed to create the session for me so in turn it failed for me.
noReset: false, fullReset: false: It does not clear the cache + it does not UNINSTALL the app.

In my case, I want to clear the cache WITHOUT uninstalling the app. I would like my application to logout after my testCase execution is finished, thus clearing the cache as well.

What is the best way to accomplish this?

this should 100% clear cache with Android app. add appium logs. How you check that cache cleared?

you could try to use https://github.com/appium/appium-uiautomator2-driver#mobile-clearapp for this purpose

but this does not log out the app after the test has finished its execution.
Am I missing something?

This works in my case. Thankyou :slight_smile:

It works only on start. If you with reset after test you need either use what Mykola sent or use something like: driver.resetApp();

When I user driver.resetApp(), it throws me below error:

[0-4] 2022-05-10T11:07:57.419Z INFO webdriver: COMMAND resetApp()
[0-4] 2022-05-10T11:07:57.419Z INFO webdriver: [POST] http://localhost:4723/session/a2ee94c9-de0f-4c1a-a58c-4baf1ed93ed8/appium/app/resetApp
[0-4] 2022-05-10T11:07:57.427Z DEBUG webdriver: request failed due to status 9
[0-4] 2022-05-10T11:07:57.427Z INFO webdriver: Retrying 1/3
[0-4] 2022-05-10T11:07:57.427Z WARN webdriver: Request failed with status 404 due to The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
[0-4] 2022-05-10T11:07:57.427Z INFO webdriver: [POST] http://localhost:4723/session/a2ee94c9-de0f-4c1a-a58c-4baf1ed93ed8/appium/app/resetApp
[0-4] 2022-05-10T11:07:57.432Z DEBUG webdriver: request failed due to status 9
[0-4] 2022-05-10T11:07:57.432Z INFO webdriver: Retrying 2/3
[0-4] 2022-05-10T11:07:57.432Z INFO webdriver: [POST] http://localhost:4723/session/a2ee94c9-de0f-4c1a-a58c-4baf1ed93ed8/appium/app/resetApp
[0-4] 2022-05-10T11:07:57.432Z WARN webdriver: Request failed with status 404 due to The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
[0-4] 2022-05-10T11:07:57.434Z DEBUG webdriver: request failed due to status 9
[0-4] 2022-05-10T11:07:57.434Z INFO webdriver: Retrying 3/3
[0-4] 2022-05-10T11:07:57.434Z INFO webdriver: [POST] http://localhost:4723/session/a2ee94c9-de0f-4c1a-a58c-4baf1ed93ed8/appium/app/resetApp
[0-4] 2022-05-10T11:07:57.434Z WARN webdriver: Request failed with status 404 due to The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
[0-4] 2022-05-10T11:07:57.436Z DEBUG webdriver: request failed due to status 9
[0-4] 2022-05-10T11:07:57.436Z ERROR webdriver: Request failed with status 404 due to unknown command: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
[0-4] Error in "0: When I click on "Log in to Gelato" button"
unknown command: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
    at async World.<anonymous> (/Users/harsha.sharmagelato.com/Dev/work/sandbox/gelato-api-mobile/integration-tests/src/stepDefinitions/login.ts:21:5)
[0-4] 2022-05-10T11:07:57.438Z INFO webdriver: COMMAND deleteSession()
[0-4] 2022-05-10T11:07:57.438Z INFO webdriver: [DELETE] http://localhost:4723/session/a2ee94c9-de0f-4c1a-a58c-4baf1ed93ed8
2022-05-10T11:07:57.668Z DEBUG @wdio/local-runner: Runner 0-4 finished with exit code 1
[0-4] FAILED in /Users/harsha.sharmagelato.com/Dev/work/sandbox/gelato-api-mobile/build/app/outputs/flutter-apk/app-stage-debug.apk - /test/features/login.feature
2022-05-10T11:07:57.668Z INFO @wdio/cli:launcher: Run onWorkerEnd hook
2022-05-10T11:07:57.668Z DEBUG @wdio/cli:utils: Finished to run "onWorkerEnd" hook in 0ms
2022-05-10T11:07:57.668Z INFO @wdio/cli:launcher: Run onComplete hook
2022-05-10T11:07:57.668Z DEBUG @wdio/appium-service: Appium (pid: 50252) killed
2022-05-10T11:07:57.668Z DEBUG @wdio/cli:utils: Finished to run "onComplete" hook in 0ms

Spec Files:      0 passed, 1 failed, 4 skipped, 5 total (100% completed) in 00:00:35 

2022-05-10T11:07:57.669Z INFO @wdio/local-runner: Shutting down spawned worker
2022-05-10T11:07:57.921Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2022-05-10T11:07:57.922Z INFO @wdio/local-runner: shutting down
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] android: `wdio ./config/android.config.ts`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] android script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/harsha.sharmagelato.com/.npm/_logs/2022-05-10T11_07_57_941Z-debug.log
~/Dev/work/sandbox/gelato-api-mobile/integration-tests #

I have a feature file with few scenarios:

in every scenario I need to login in app and then do checks

But if first scenario failed on step after login, it does not perform logout

and then second scenario is failed.

How to bring app to first state? (start app, and not logged in)

driver.resetApp() does not work for me

If you reset app manually it helps to logout?

yes manually it works perfectly

Does reset app does not work at all for you? Where in code you tested? Maybe you called it after driver quite?

Add more details. Appim version, java or what client version…