I’m testing an android app with Appium + Cucumber + Ruby. I need to reinstall (or clear data) the app for some scenarios and for some scenarios I don’t need that (or at least just restart the app). I mean if I’m running test for a feature, is it possible to specify that for each scenario? How can I do that? Thank you
I have a test that puts my app into a state that a customer would never see. It’s the last test in a suite, and I restart the driver to clear data. The way I do it is to tag my scenario with an @restart and then in my hooks.rb I add the following:
i am solving it with testNG by specifying parameter like: fullReset, fastReset and nothing.
in “beforeMethod” i am reading this parameter and specify how driver to start:
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 for Android / reinstall app for iOS
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);
}
normally i do ONE test with fullReset to install new version, min possible number of tests with fastReset (cause it is slowing start) and all other tests with normal start.
Hello Alekesi
I have a question for you
Q:what was the particular desired capabilites we need to set it will tell
appium not to re-install the application on device.
Hi @Aleksei. i am new for appium. i think this logical part we need to add in script i am right…
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);
}
Links from google first page results below.Start trying, making mistakes its normally the best way to learn. Anything that you get stuck in (try to resolve on your own first) ask in here with code and screenshot from inspectors.
For pinch and zoom, play with TouchAction and MultiTouchAction.
Thanks @Telmo_Cardoso I have a Question.
Q:I want to test android native apps but i dont have a .apk file how to install the apps on mobile device?
2. how to launch apps by using appium server.?
if you dont have the apk, you can use one that is already installed in device. just use the following capabilities:
capabilities.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "replace by start activity");
capabilities.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "replace by android package");
I understand this way " suppose 1.0 version all ready install in my device after some modification dev team release 1.1 v to testing team but they doesn’t give the apk file.that time we need to set that desied capabilites in our script"…I am correct @Telmo_Cardoso
Q:suppose you are worked on new project first build release 1.0v apps is not already install in your device they dont give you .apk file that time how you install and test?
Hi @Telmo_Cardoso thanks for response your sugesstion is very helpful to me.I have a question
Q:how to automate otp verification can you please provide the script ?
Hi @Telmo_Cardoso thanks for quick response.
is it necesaary to used sms reader app for otp verifaction any alternate way is there…
Q:how to handle popups in navtive apps is it possible.based on my knowldege web view apps we can handle popup by using alert interface.
Hi @Appium_Learner I use sms reader app, because each Android has one different native SMS default app and I would have to find a way to automate hundreds of different devices. Using that sms reader was the solution I found. There might be others.
I can check popups in the same way I verify all the rest…