buttons

Appium-Capabilities-5 : Difference Between Capabilities “noReset” Vs “fullReset” | Step-By-details

 

Appium-Capabilities-5 : Difference Between Capabilities “noReset” Vs “fullReset” | Step-By-details

Get a step-by-step walkthrough in the video below!

In Appium, the capabilities noReset and fullReset are used to control the state of the app (and device) before and after a test session. Understanding the difference between them is crucial for managing app data, login states, and performance.

noReset vs fullReset in Appium

Press enter or click to view image in full size

Detailed Explanation:

noReset: true

  • App is not reinstalled.
  • App data is retained. Login sessions, local data, preferences remain intact.
  • Faster test execution, especially useful when testing across multiple test cases using the same session.

Use case:
When you want to test a feature that requires a logged-in user or when you don’t want to repeat app setup steps.

Example:

"appium:noReset": true

fullReset: true

  • App is uninstalled and reinstalled before each session.
  • All data is cleared.
  • Simulates a fresh install from scratch.
  • Slower due to install/uninstall.

Use case:
Ideal for testing app onboarding, fresh installs, or app upgrade flows.

Example:

"appium:fullReset": true

Important Interactions:

Press enter or click to view image in full size

“Complete Code: Optimized and Ready to Use”:

package com.appiumguide.capabilities;

import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.options.UiAutomator2Options;
import java.io.IOException;
import java.net.*;
import java.time.Duration;

/**
* Script Details - "Appium Capabilities-5: Difference Between Capabilities “noReset” Vs “fullReset” |Step-By-details"
*
* appium-java-client version: Latest
*
* @author 'Ramesh Kodumuru' for AppiumGuide [appiumguide@gmail.com]
*/


public class NoresetVsFullresetDemo {

private AndroidDriver driver;


@BeforeTest
public void setup() throws MalformedURLException {

UiAutomator2Options cap=new UiAutomator2Options();
cap.setPlatformName("android");
cap.setAutomationName("uiautomator2");
cap.setDeviceName("Pixel6");

//Install apk by using desired capability
String basepath=System.getProperty("user.dir")+"/APK_Files/";
String apkpath=basepath+"ApiDemos.apk";
cap.setApp(apkpath);

//Using NoRest Capability
//cap.setNoReset(true);
//cap.setAutoGrantPermissions(true);

//Using FullRest Capability
cap.setFullReset(true);
cap.setAutoGrantPermissions(true);



driver = new AndroidDriver(new URL("http://127.0.0.1:4723"), cap);
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(100));

}

@Test
public void test() throws InterruptedException, IOException {

}

@AfterTest
public void teardown() {

if(driver!=null) {
driver.quit();
System.out.println("Test Completed");
}

}

}

No comments:

Post a Comment