ManDD
May 3, 2017, 2:46pm
1
I am using Java with TestNG framework
Any Best Practice to make sure that the app is reinstalled when starting an Appium session / Test Suite , so the tests are not performed on a previous (already installed on device) version of the app.
My capability “NoReset” is set on ‘true’, to make sure that the app is not reinstalled between tests/methods.
wreed
May 3, 2017, 5:37pm
2
You could write a cleanup method that includes driver.removeApp(bundleId). Running it at the end of your tests should ensure that you always start out with a clean testing environment.
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.appium.java_client;
import static io.appium.java_client.MobileCommand.CLOSE_APP;
import static io.appium.java_client.MobileCommand.INSTALL_APP;
This file has been truncated. show original
@ManDD Normally i do 1 test with fresh client install in suite. i am setting it as parameter in testNG xml. final code to open driver is:
if (devicePlatform.contains("fullReset")) { // reinstall 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 without reinstall
System.out.println(" Driver DO FAST-RESET");
capabilities.setCapability(MobileCapabilityType.FULL_RESET, false);
capabilities.setCapability(MobileCapabilityType.NO_RESET, false);
} else {
System.out.println(" Driver DO NORMAL start");
capabilities.setCapability(MobileCapabilityType.FULL_RESET, false);
capabilities.setCapability(MobileCapabilityType.NO_RESET, true);
}