3

I have already created automated test cases using selenium and java for desktop web testing. Is there a way for me to run the same tests on my personal mobile? Searching on google I find resources linking to native app testing and mobile tests for devices that are hosted on cloud. If you can point me to a resource or tool that would be very helpful!

1

If you have the tests for desktop version of an app then you will likely be not able to execute the same for mobile version of an app since when a server detects that you are using mobile browser it sends a mobile version of a page to the client.

Normally such page has different layout and classes so that your locators won't be working.

2
  • I am doing this for learning purposes and the webpage has some elements with unique Ids assigned to them. I don't get it why the locators won't work because the same page will load on mobile as well so layout maybe different but the elements will still retain their id attributes or won't they?
    – Rohit
    May 6 '20 at 11:40
  • 1
    Not necessarily. This depends on how your application is implemented. Normally mobile sites have very simplified structure. There might be the case when some the UI controls are missing (because of the difference user experience with mobile device) so having even id attribute would not help much to port the cases. Probably to get more specific answer you should come up with more details. Like:"I have this page on my desktop site and this page when open it up on my mobile device. And here is my representative piece of automation code. How do I port this to appium framework or alternatives?".
    – Alexey R.
    May 6 '20 at 11:50
1

The best available tool is Appium.

It meets the requirements for the mobile testing services as it is open-source, and a cross-platform test automation tool used to automate native, hybrid, and mobile web apps for iOS and Android devices.

In your scenario, the test cases automated for the web application can only be executed directly on the mobile web browser provided that in the mobile-web view -> the element's locators, functionality flow and UI elements remain same as that in desktop web app view

Moreover, if functionality flow/UI elements are same in both mobile-web/desktop-web view then, the following approach can be used to accomplish your goal:

  • Add the locators for the mobile web app to the automation framework
  • Add a variable to assign execution platform : Web Or mobile
  • Then configure automation scripts to pick the respective locators at run time depending upon the platform being executed
0

By far the easiest way to do mobile testing is testRigor. You can just specify the home URL and write steps in English like:

click "My Product"
click "Add to Cart"
enter "4111111111111111" into "card"
click "Place Order"
check that page contains "order successful"

Disclaimer: I'm a co-founder of testRigor.

0

Mobile testing is more intricate than web testing. But, you can make life easier by using a dedicated tool. There are many mobile automated testing tools. I am pointing some of them that would be helpful for you.

Appium is compatible with all modern programming languages, supports automation across a variety of platforms, and automates all types of applications.

A few other similar tools are Calabash, UI Automator, Robotium, SeeTest, TestComplete, and TOSCA. There are pros and cons for each that we should check thoroughly.

0

With the mobile market becoming more prominent year after year, it is important to ensure that your website renders perfectly on mobile devices and that it gives users a flawless digital experience.

An easy way of ensuring your website performs well across multiple mobile platforms is through test automation. Test automation using frameworks like XCUITest, Apium, or Espresso allows you to create and execute mobile test cases with ease.

For instance, you can use a platform like Perfecto to automate mobile tests using Apium, a popular framework that supports a wide range of programming languages including JavaScript, Java, Python, Perl, and C#.

Since Apium relies on a RemoteWebDriver, you will need to set it up. The RemoteWebDriver facilitates remote connection to the cloud or a testing lab with multiple devices.

Here is an example showing how to configure your RemoteWebDriver against the desired test capabilities.

String host = "mymobilecloud.perfectomobile.com";
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "9.0");
capabilities.setCapability("user", "myUser");
capabilities.setCapability("securityToken", "myToken");
URL url = new URL("https://" + host + "/nexperience/perfectomobile/wd/hub");
RemoteWebDriver driver = new RemoteWebDriver(url, capabilities);

After setting up the RemoteWebDriver, you can proceed to running the tests and validating your website.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.