Automation Testing Challenges and Their Solutions

Automation Testing Challenges and Their Solutions

By Dinakar | Posted on February 12, 2021 | 7 min Read

Automation testing can be a highly effective productivity booster and quality enhancer for both, your product pipeline and system development projects if implemented correctly. However, it can be a tedious task to apply the best practices when a team is just starting the implementation. In this blog, we are aiming at shedding light on some of the most common challenges that teams face as they pursue automation and possibly provide valuable solutions to overcome these challenges.

But first, let’s have a look at the most prevalent automation testing challenges:

1. Selecting a suitable automation testing approach

Testers need to find an appropriate test automation approach. To do so, they need to find answers to important questions like how to reduce the effort in both implementation and maintenance of test script and test suite? How to generate useful test reports and metrics? Will the automation test suites have a longer lifetime? Most times answering these important questions eases the process of heading in the right direction. In agile development, the app under test often changes through development cycles. So, designing and implementing automation test suites to correctly identify these changes and keeping the system up-to-date is a reasonable maintenance effort that is necessary and tedious. In these cases, an ideal solution would be to have a test automation solution that can detect these issues and automatically update & re-validate the test without any human intervention.

2. Choosing the right automation tools

Selecting the right automation tools can be problematic for QA teams because either their tools of choice don’t offer 100% test coverage or the cost of tools exceeds their test budget. Or maybe they even lack the expertise to make the most of a specific tool. Nonetheless, if your team doesn’t know how to use a tool, you can buy an online course for your testers, or hire a consultant who can help your team master it. Reach out to the testing community if you’re still looking for the right automation tool – forums like Stack Exchange provide a rich source of information for questions that you might have in your mind.

Sometimes the tool you use might not do everything you need. In that case, you should start searching for solutions that cover areas critical to your team. If the tool you found is way out of your budget, just prepare a cost vs. benefit analysis and present your case to the executive team. An analysis of expenses coming from bugs would have been solved if you had the right tool in place. Comparing different frameworks is key to get the right fit for your automation needs

3. Rigorous lab management

Many teams prefer to build and maintain their labs. This isn’t necessarily a bad thing. However, in-house labs are hard to manage and also expensive. With new operating systems, devices, and browser versions consistently being released, in-house labs can quickly become obsolete if not updated every once in a while, which is again an additional cost. As a result, teams end up spending a lot of time maintaining and running their lab instead of putting their time into testing. Having a cloud-based device lab is key for continuous testing unless there are some special testing requirements/scenarios with IoT, special networking (especially in the Telco space), etc.

4. Sorting through all the data

DevOps automation results in a huge influx of data that needs to be reviewed and analyzed. Teams often find they are swimming in a sea of data made up of log files, architecture diagrams, and test results. However, this data does contain a lot of useful information. The challenge comes in when we try to sort this data. For example, insights from data can inform R&D teams on what fixes need to be made. Making sense of all the data is a big undertaking for many teams, especially those that are not equipped with the right tools.

To achieve fast feedback, you need to be able to sort through the noise. Today, the reality of CI/CD is that it requires teams to execute tests and analyze results in minutes to understand where the problem lies and fix them at the earliest. Using test analytics can help you understand the problem and avoid it.

5. Knowing when to begin and stop testing

A big challenge that most if not all test managers face is knowing the answer to when to begin a test or when to stop it. You don’t want to initiate automated testing at the wrong stage of your software’s life cycle, as this would hamper the timelines of the production releases. A helpful piece of advice is to start with manual testing. Because when you start with manual testing the engineers will be able to tell when the system is stable enough and ready for automated testing. When your team is convinced that certain functionality or task can be pushed for automation, there is a better workflow as the team is aware of the timelines and is already prepared for closing tasks one after the other.

How to overcome these challenges?

  1. Whether a tester is an automation ninja or a manual tester with basic knowledge of the business flow, the tools should be understandable to the level of the user. Because in the end, the automation tools will allow manual testers to begin executing automation while advanced testers can focus on higher priority tests. This refers to the ability to successfully scale test automation operations.
  2. The solution should offer capabilities that help teams take a small, locally-run test and apply it across multiple platforms, devices, and browsers. This ensures the required scaling and test coverage.
  3. In today’s competitive world, teams need to have the ability to conduct a test anywhere, anytime. A comprehensive solution to this need would be to provide open access to the lab and equip teams with the right tools to run and perform tests. This ultimately helps them be adaptable and keep pace with the new releases.
  4. To achieve success with continuous testing and automation, teams need to be able to effectively see clear and accurate test results quickly. What’s more, they need to identify problems quickly. Remember, automation creates noise and false negatives, so teams need to be able to sort through this to provide the necessary evidence.

The only way to successfully address the top challenges in automation testing is to use a solution that combines the four components listed above. If a solution is missing one of the components, a critical part of the continuous testing process is lost. What’s more, there is a good chance team will spend a significant amount of money accounting for gaps or compromising quality.

Conclusion

While the challenges mentioned here are not the only ones in the list of challenges for automation testing. There are other challenges also such as lack of collaboration and skills. But those challenges are not hard to overcome. Whether we talk about mobile automation testing challenges or Selenium automation challenges for web apps, cloud-based testing is the solution. It gives you the flexibility and scalability needed to deliver a quality product in less time. With the right tools, skillset, and infrastructure, these challenges can be overcome over time.

Automation testing
Dinakar
Dinakar

Dinakar is a Content Developer at pCloudy. He is an ardent technology explorer who loves sharing ideas in the tech domain. In his free time, you will find him engrossed in books on health & wellness, and playing the guitar. He loves the sight of the oceans and the sound of the waves on a bright sunny day.

Discussion

Leave a Reply


Can't read the image? click here to refresh


Read more Articles

September 24, 2021
How to Choose The Right Automation Testing Tool

Test automation is gradually taking over manual testing as it saves time and improves the quality of testing. Especially in the case of regression testing, automation can improve efficiency by manifold times. It is a waste of time and resources…

Learn More Arrow

September 6, 2021
Challenges in Mobile App Testing

Today, there are many smartphone users in the world and so is the popularity of mobile apps. In order to be competent, mobile apps have to be unique and provide the best user experience to increase the user base. With…

Learn More Arrow

April 28, 2020
Test Local And Internal Servers Before Deployment Using Wildnet

Some testing teams set up their own staging environment to test internal servers but as there is no public access which makes it difficult to perform local testing on remote devices. So how would you test your app which can…

Learn More Arrow

Flutter App Automation Using Appium Flutter Driver

Flutter App Automation Using Appium Flutter Driver

By Suyash dubey | Posted on November 4, 2019 | 5 min Read

Flutter has been creating waves in the app development space since its launch. The reason is simple, it solves the problem of creating two different codebases for a single app to run on Android and iOS devices. Some experts say that Flutter which was launched by Google is to counter React Native which is used by Facebook. Nevertheless, this is a much-needed relief for enterprises as Flutter will help them save a lot of their time and resources. So let’s first understand what is Flutter.

What is Flutter

Flutter is an opensource mobile UI framework that can create Android and iOS apps from a single codebase. The Flutter framework includes the Flutter engine, Dart platform, the Foundation library, and design-specific widgets. Flutter apps are written in Dart programming language and runs on dart virtual machine.

How to Create a Flutter App

Before we start the process of app development it is important to know that there are two types of widgets, stateless and stateful. A stateless widget describes part of the UI by building a structure of other widgets that describe the UI more definitive. Stateful widgets are the widgets that can change their state multiple times and can be redrawn on to the screen any number of times while the app is in action.

To create a Flutter app you need to install Flutter SDK and other tools required to support the framework. We will create the app in Intelli J IDE and for that, you need to install two plugins. The first one is Dart and the second plugin is Flutter. You can install the plugins by clicking on File in the menu bar of the IDE and then click on Settings.

1

Then you need to create a new project and you will get a basic code layout to start with your app development. In the first line, we have the main method where we will enable the flutter driver extension and there is a run app method with MyApp class instance, to run the app.

Flutter stateless

In this sample code, we have used the title as the stateless widget and we have set the title as the key and for the home screen, we are using one more instance which is MyStatefulWidget(). So in this class, we have a small piece of code, where we have set values for elements like appBar, background color, and in the body, we have placed a floating action button for a counter.

flutter statefull

After adding the code you can run the program and you will be able to see the changed state of the counter with every click on the action button.

Flutter automation

Appium Flutter Driver

Appium Flutter driver is a test automation tool for flutter apps on multiple platforms. It is a part of the Appium mobile test automation tool. But how does the Appium Flutter driver work? It uses webSocket communication to carry WDIO script to instantiate the flutter driver and the request will be sent to the particular application. Then the AUT will send the response to the script through the Appium Flutter driver.

Appium Flutter driver
Appium Flutter driver

You can also build Appium in your machine through the source code. Once you have cloned the source code, run npm install then npm run built and type a command node to start the Appium server. You can download the package from GitHub. The package contains Appium Flutter Driver and Appium Flutter Finder. You can clone the sample project to get the WDIO code.

Flutter sample

In the terminal, you can see that to automate flutter application we have used Flutter as an automation name for both Android and iOS apps. You can see that port is 4723 and in the capabilities, we have mentioned osSpecificOps, automation name: ‘Flutter’. We have mentioned the app path at the top with the device name and platform name and we created an object.

Flutter Terminal

Appium==OS environment is ‘android’ which will pick all the information and specify in the capabilities and it will pass a post request to the server.

Now here we are trying to find the element using CounterTestFinder and a ButtonFinder to click on the button. In the next line, we have created a driver using a remote method.

Then we have switched the Native App context to Flutter. You can switch this if you are using the Flutter app. Once the app is launched, we are validating that the counter text finder has value as zero by calling Flutter APIs internally. So here we are using two actions, one is clicking and the other is touch.

Flutter code

The button is to be clicked two times and thus we have used strictEqual function. In the last line of code, we are deleting the session.

Now to run the test we need to pass the environment variable to connect the device.

Flutter demo

Then we will check if our Appium server is running.

Flutter Appium

Then once you run the code you will be able to see the actions performed on the device and the counter will change to two.

Flutter Appium automation

This is how you can automate your Android and iOS app testing using Appium Flutter driver. Although there are many benefits of using Flutter, there are some limitations as well. The first thing is that you need to learn Dart language to develop and automate the Flutter app.

Suppose you need to run automated tests on multiple devices, then you will have to fire multiple commands in the terminal. Appium flutter driver depends on Flutter Driver APIs and as it’s still not matured enough, some actions cannot be performed.

Suyash Dubey
Suyash Dubey

Suyash is a content strategist at pCloudy. He is a frequent contributor to the world's leading mobile technology blogs and tech forums. In his spare time, you will find him reading detective novels, watching a documentary or exploring a new destination.

Discussion

Leave a Reply


Can't read the image? click here to refresh


Read more Articles

February 12, 2021
Automation Testing Challenges and Their Solutions

Automation testing can be a highly effective productivity booster and quality enhancer for both, your product pipeline and system development projects if implemented correctly. However, it can be a tedious task to apply the best practices when a team is…

Learn More Arrow

February 24, 2020
5 Best Practices To Avoid Test Automation Failure

Automation testing forms the core of any CI/CD pipeline and enterprises are keen to practice test automation to enhance the efficiency of the development process. Test automation saves resources and reduces the cost of any project in the long run.…

Learn More Arrow

October 23, 2019
Run Espresso on pCloudy using pCoudy Utility

Espresso is a testing framework for Android which automatically synchronizes your test actions with the UI of your app. It also lets the test wait until all the background activities have finished.   The pCloudy utility uploads your Application APK,…

Learn More Arrow

8 Common Appium Mobile Test Automation Mistakes and How to Avoid Them

8 Common Appium Mobile Test Automation Mistakes and How to Avoid Them

By Priyanka charak | Posted on October 12, 2018 | 6 min Read

Appium Mobile Test Automation

As we all know that Appium is the most preferred test automation tool for mobile applications. It is the first choice of the testers because of its flexibility i.e. it is open source, it has the best supported and highly active community of experts, Appium works across different platforms and works well with different scripting languages. Even after gaining such a popularity and having a strong community base, surprisingly,the users still make mistakes while running the mobile test automation with Appium.

Here are a few common mistakes that Appium users encounter while using Appium Mobile Test Automation Tool:

1.Unrestricted X Path Usage:

Over usage of X Path could be found in case of Selenium as well but when it comes to Appium world, it has more outrageous effects because X Path is a more dynamic way to unearth the elements. But the biggest stumbling block in this scenario is its huge performance cost due to which it becomes elusive an area. This is because Google and Apple do not provide XML or XPath related queries in a way we would need them to be. All of this hospitalizes an unmanageable cost finding elements using X Path. Undoubtedly, X Path is the most trusted method but there are several other better locator methods like ‘Accessibility IDs’ that can be used in this sitch.

2. Neglected usage of Accessibility IDs:

The accessibility ID locator strategy is formulated to read a unique identifier for a UI element. For both iOS and Android, getting an element by their accessibility ID is the best method. Most importantly, it is preferable because it is quicker. It should be noted that semantically accessible IDs are different than the Web IDs. However, the two shouldn’t be combined. In many cases, the accessibility IDs are used only for the purpose of testing even though they have a larger purpose. So, in order not to spoil the accessibility of the applications just for the sake of testing, the bigger purpose of the accessibility IDs should be known. If the accessible IDs are set up on the elements to make the apps testable, the app accessibility also increases, provided that the accessibility labels are sensible to the users using them. But the foremost criteria not to make automation efforts a failure is to make the application testable in the first place.

3. Not making a testable App:

Developing an app should be a forecasted move where in the developers, even before writing the first line of code, plan to develop an app keeping the automation in mind. This they can achieve by keeping in mind the hooks and the unique IDs for the elements in order to make the app more testable. This strategic approach would be a reason for a successful mobile app test automation. Apart from this, there should also be a concentration on the different testing scenarios in order to elude the chances of overlapping before even getting into Appium coding. An open discussion forum with the development teams to discuss the plotting of right accessibility IDs, labels or Unique IDs for the application’s elements would reduce many test automation reliability concerns.

4. Disregarding Application View States:

One of the challenge faced in Mobile Test Automation is not setting up the application. Most of the developers do not set up the application in order to access specific views and user states rapidly. To quote an example given by Jonathan Lipps,one of the key contributors to the Appium project.

A shopping cart functionality of the app might have ten different tests, and ninety percent of the tests might go through the same steps of logging in and searching items to be put in the cart which is a huge waste of time.

So, your team should be able to set up an app’s state and start the test in that apposite state, straightaway. This is highlighted in Appium scenario due to the fact that the mobile simulators and emulators are slow and take longer than usual to reach to the right position on the test.

5. Query for every element visibility:

Not querying for the visibility of every element is another way to speed up the run-time of the Appium test scripts. This leads to an additional load of calls and waiting time for Appium while in the every activity of retrieving an element. The lag can be reduced by only requesting the element attributes which are important in perspective of the test code.

6. Native Testing tools – Always better?

According to some developers, usage of the native testing tools is the best way to get unfailing mobile tests. For example- Espresso in case of Android and XCUITest in case of iOS. This is not good advice as neither of Google or Apple are going to release and new automation technology. When the question is of stability, the stability of code should be chosen rather than technology and in this scenario, Appium is the best choice!

As an exception, if the development team writes the tests and it’s most comfortable in mobile SDK language, using Google and Apple providers to build development environments. Also, when the constricted test-app or test code-app code integration is needed, then Appium might not be of much help. The utmost value is that Appium provides the WebDriver layer on top of the technology, which means the code can be written in any language and acts as a stable interface to that specific automation technology. Also, being a cross-platform tool, Appium allows to saves a lot of code and architecture in case of testing both iOS and Android devices.

7. Appium is slow:

Appium might be slower in some circumstances and also there are points in Appium codes where it does not seem efficient. Appium backs upon technologies that are slower than Appium and the curators of Appium have strategically chosen to utilize slower strategies for specific instances. For eg: Appium will certainly be slower if you are relying on XPath. The efficiency of the tool depends on how it is being used. Mostly, Appium is favored because of stability than the speed.

8. Not Using Appium Documentation:

The earlier Appium docs were not very user friendly. As a result, they weren’t used as much as they needed to be but the new Appium documents have been completely redesigned and reorganized. Information about the API reference to Appium, client libraries, supported drivers and Appium commands, code examples which was not provided before is all documented in the updated version. It deserves a revisit due to its newness and can be accessed at Appium.io.

Priyanka Charak
Priyanka Charak

Tech Blogger - She writes about Technology, Mobile Application Development, Internet of Things, E-commerce, Computing and Design with the aim to coalesce new media and technology.

Discussion

Leave a Reply


Can't read the image? click here to refresh


Read more Articles

September 24, 2021
How to Choose The Right Automation Testing Tool

Test automation is gradually taking over manual testing as it saves time and improves the quality of testing. Especially in the case of regression testing, automation can improve efficiency by manifold times. It is a waste of time and resources…

Learn More Arrow

September 6, 2021
Challenges in Mobile App Testing

Today, there are many smartphone users in the world and so is the popularity of mobile apps. In order to be competent, mobile apps have to be unique and provide the best user experience to increase the user base. With…

Learn More Arrow

February 12, 2021
Automation Testing Challenges and Their Solutions

Automation testing can be a highly effective productivity booster and quality enhancer for both, your product pipeline and system development projects if implemented correctly. However, it can be a tedious task to apply the best practices when a team is…

Learn More Arrow

pCloudy Part of G2 Crowd Grid

pCloudy Part of G2 Crowd Grid

By Avinash | Posted on October 24, 2017 | 1 min Read

G2 Crowd


pCloudy now part of G2 Crowd Test Automation Grid. We thank our customers for making us high performer.

G2Crowd Test Automation Software

Read More

Avinash
Avinash

Avinash Tiwari is a thought leader, a recognized keynote speaker, and the co-founder of pCloudy.com. He has 15+ experience in Product development and Testing. He brings with him a passion for emerging technology and quick adoption, both of which have solidified his reputation as a leader in the mobile app testing field.

Discussion

Leave a Reply


Can't read the image? click here to refresh


Read more Articles

February 12, 2021
Automation Testing Challenges and Their Solutions

Automation testing can be a highly effective productivity booster and quality enhancer for both, your product pipeline and system development projects if implemented correctly. However, it can be a tedious task to apply the best practices when a team is…

Learn More Arrow

February 24, 2020
5 Best Practices To Avoid Test Automation Failure

Automation testing forms the core of any CI/CD pipeline and enterprises are keen to practice test automation to enhance the efficiency of the development process. Test automation saves resources and reduces the cost of any project in the long run.…

Learn More Arrow

November 4, 2019
Flutter App Automation Using Appium Flutter Driver

Flutter has been creating waves in the app development space since its launch. The reason is simple, it solves the problem of creating two different codebases for a single app to run on Android and iOS devices. Some experts say…

Learn More Arrow

“Representative Mobile App Functional Test Automation Vendors (Commercial)” in Gartner’s Market Guide for Mobile App Test Automation Tools

“Representative Mobile App Functional Test Automation Vendors (Commercial)” in Gartner’s Market Guide for Mobile App Test Automation Tools

By Avinash | Posted on August 4, 2016 | 2 min Read

Gartner’s Market Guide

Delhi, June 23, 2016 – Smart Software Testing Solutions (SSTS), a leading provider of Mobile App Test Automation Tools, today announced that it has been identified as one of the Representative Mobile App Functional Test Automation vendors in the Gartner’s Market Guide for Mobile App Test Automation Tools(1).SSTS was named in the category of commercial vendors with functional test automation and device cloud capabilities.

According to Gartner, ‘’the need for automation in mobile app testing is driven by business time-to- market demands and digitalization initiatives. These push mobile app development teams to adopt agile development approaches to deliver high-quality mobile apps faster. This rapid pace, combined with a broad and changing device ecosystem, creates a challenging environment in which to maintain a high level of quality. Without automation, it will end up crushing all but the most trivial app efforts.’’

“We believe our inclusion as a representative vendor in the Gartner Market Guide validates why the world’s best-known brands rely on SSTS, to drive their Mobile Test Automation,’’ said Avinash Tiwari, Director, Smart Software Testing Solutions, explaining the unique position of the company in the Indian market.

pCloudy is the flagship product company of SSTS (Smart Software Testing Solutions). Avinash Tiwari opines that the market in India is becoming more and more receptive of automated testing solutions and cloud based testing platforms. More and more organizations are feeling pressure to make releases more frequently. Moreover, creating right test infrastructure for mobile Apps is a key concern for organizations. pCloudy is in a unique position to serve both the challenges.

If you have a Gartner Account, you can download the report by clicking on this link.

Gartner Disclaimer

Gartner does not endorse any vendor, product or service depicted in its research publications, and does not advise technology users to select only those vendors with the highest ratings or other designation. Gartner research publications consist of the opinions of Gartner’s research organization and should not be construed as statements of fact. Gartner disclaims all warranties,expressed or implied, with respect to this research, including any warranties of merchantability or fitness for a particular purpose.

(1) Gartner, Inc. ‘’Market Guide for Mobile App Test Automation Tools’’ by MaritessSobejana, Adrian Leow, 25 April 2016

Avinash
Avinash

Avinash Tiwari is a thought leader, a recognized keynote speaker, and the co-founder of pCloudy.com. He has 15+ experience in Product development and Testing. He brings with him a passion for emerging technology and quick adoption, both of which have solidified his reputation as a leader in the mobile app testing field.

Discussion

Leave a Reply


Can't read the image? click here to refresh


Read more Articles

September 6, 2021
Challenges in Mobile App Testing

Today, there are many smartphone users in the world and so is the popularity of mobile apps. In order to be competent, mobile apps have to be unique and provide the best user experience to increase the user base. With…

Learn More Arrow

August 9, 2021
Why is it Important to Test Your Mobile Apps on Different Devices?

The Technology involved in mobile devices is changing rapidly. Mobile phones have literally personalized the choices in our lives, experts forecast that the future devices will enable us to get much done without moving an inch or a finger. The…

Learn More Arrow

February 12, 2021
Automation Testing Challenges and Their Solutions

Automation testing can be a highly effective productivity booster and quality enhancer for both, your product pipeline and system development projects if implemented correctly. However, it can be a tedious task to apply the best practices when a team is…

Learn More Arrow

Help Guide for pCloudy-java-Connector for Appium

Help Guide for pCloudy-java-Connector for Appium

By Avinash | Posted on December 14, 2015 | 3 min Read

pCloudy Appium integration

1. pCloudy-java-Connector for Appium

1.1 Overview

Appium is an open source test automation framework which is used with wide range of mobile apps that supports only android/ios or both. pCloudy is a popular mobile testing platform integrated with Appium script which enables you to automate test of mobile apps as well. If you have your Appium Scripts (or you plan to build them) in Java then you can use the pCloudy-java-connector.jar to integrate with the pCloudy platform. In case, you don’t have your Appium script then, you will need to use the rest web services APIs which are given in the end of this document.

1.2 Objective of this document

This user help guide has been developed for pCloudy end users. This help guide will help you to understand the APIs that pCloudy platform provides to integrate your existing Appium Scripts with pCloudy. After the integration, you will be able to execute your Appium scripts from your PC directly to the pCloudy real device cloud.

1.3 System Requirements

  • Java based Appium Script
  • Eclipse or Netbeans
  • >APK or IPA file
  • pCloudy Account
  • pCloudy-java-connector jar

NoteThe APIs are evolving and we will come back with a better set of APIs & the jar soon. You might need a little tweaking in the code.

1.4 Stepwise Workflow of the APIs for getting an Appium Driver

The basic steps to get APIs for Appium Driver are given below:

appium testing

1.5 How to get my API Key for using the services

If you are a registered user then you just need to follow few simple steps to get API key for using our services.

Login to pcloudy.com –

Appium

After successful login, Instant Access page opens. Now, you finds different devices which can be filtered from the above given dropdown list of devices. From this page, you can book your device by clicking on Book your Device link. Furthermore, you can connect with any given device to perform mobile testing but you will be given 10 minutes only. While performing testing operation on selected device, you cannot perform testing on other device simultaneously.  For this, you need to release previously connected device.

When you click on settings option, support page opens by default which helps you to drop support ticket. It also includes various options like support, History, Test Runs, UDID, Profile, Credits, Unsubscribe, and API.

1.6 How to integrate my existing Appium Scripts on Java with pCloudy

You need pCloudy java connector jar file and corresponding APIs for Appium based mobile testing platform, pCloudy. You should add the pCloudy-java-connector.jar in its build path as a reference within the your java project containing appium scripts. See this link to learn how to add reference in eclipse.You can download pCloudy-java-connector.jar from this link –

http://support.pcloudy.com/solution/articles/9000062255-adding-reference-to-jars-in-eclipse

While downloading such file, you may come across message as given below which alerts you regarding safety of your computer.

pCloudy java connector jar file

Now, you can reference the JAR file in Eclipse or Android studio. Please refer the link.

The pCloudy-java-connector.jar comprises the following methods which gives you a wrapper code over the web services. Furthermore, you will not need to call the Rest APIs if you are working on JAVA:

Appium Automation Testing

1.7 Useful Codes to get Web-Driver Object

A. Run on Android Native

public void runExecutionOnPCloudy() {
Connector pCloudyCONNECTOR = new Connector();

// User Authentication over pCloudy
String authToken = pCloudyCONNECTOR.authenticateUser(“abc@gmail.com”, “asd53sd3fa4asd5fsasda”);
ArrayList selectedDevices = new ArrayList<>();

// Populate the selected Devices here
selectedDevices.add(MobileDevice.getNew(“Gionee_Ctrl-V6L_Android_4.4.2”, 73, “Ctrl-V6L”, “Ctrl V6L”, “android”, “4.4.2”, “Gionee”));

// Book the selected devices in pCloudy

BookingDtoDevice[] bookedDevicesIDs = pCloudyCONNECTOR.bookDevicesForAppium(authToken, selectedDevices, 5, “friendlySessionName”);
System.out.println(“Devices booked successfully”);

// Upload apk in pCloudy
PDriveFileDTO pDriveFile = pCloudyCONNECTOR.uploadApp(authToken, new File(appPath));
System.out.println(“ipa file uploaded successfully”);
pCloudyCONNECTOR.initAppiumHubForApp(authToken, pDriveFile);

// Get the endpoint from pCloudy
URL endpoint = pCloudyCONNECTOR.getAppiumEndpoint(authToken);
System.out.println(“Appium Endpoint:” + endpoint);

// Create multiple driver objects in multiple threads
for (int i = 0; i < bookedDevicesIDs.length; i++) {
Thread.sleep(5000);
new Thread(getTestCaseClass(endpoint, bookedDevicesIDs[i])).start();
}
}

private Runnable getTestCaseClass(final URL endpoint, final BookingDtoDevice dto) {

// this will give a Thread Safe TestScript class.

// You may also like to have this as a named class in a separate file

return new Runnable() {
@Override

public void run() {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“newCommandTimeout”, 600);
capabilities.setCapability(“launchTimeout”, 90000);
capabilities.setCapability(“deviceName”, dto.capabilities.deviceName);
capabilities.setCapability(“browserName”, dto.capabilities.deviceName);
capabilities.setCapability(“platformName”, “Android”);
capabilities.setCapability(“appPackage”, appPackage);
capabilities.setCapability(“appActivity”, appActivity);
capabilities.setCapability(“rotatable”, true);
AppiumDriver driver = new AndroidDriver(endpoint, capabilities);

// Your Test Script Goes Here…

}
};
}

B. Run on Android Web

public void runExecutionOnPCloudy() {
Connector pCloudyCONNECTOR = new Connector();

// User Authentication over pCloudy

String authToken = pCloudyCONNECTOR.authenticateUser(“uttam.kumar@sstsinc.com”, “sadf54sad65fds6sdsdsw”);
ArrayList selectedDevices = new ArrayList<>();

// Populate the selected Devices here
selectedDevices.add(MobileDevice.getNew(“Gionee_Ctrl-V6L_Android_4.4.2”, 73, “Ctrl-V6L”, “Ctrl V6L”, “android”, “4.4.2”, “Gionee”));

// Book the selected devices in pCloudy

BookingDtoDevice[] bookedDevicesIDs = pCloudyCONNECTOR.bookDevicesForAppium(authToken, selectedDevices, 5, “friendlySessionName”);
System.out.println(“Devices booked successfully”);
pCloudyCONNECTOR.initAppiumHubForBrower(authToken, “Chrome”);

// Get the endpoint from pCloudy
URL endpoint = pCloudyCONNECTOR.getAppiumEndpoint(authToken);
System.out.println(“Appium Endpoint:” + endpoint);

// Create multiple driver objects in multiple threads
for (int i = 0; i < bookedDevicesIDs.length; i++) {
Thread.sleep(5000);
new Thread(getTestCaseClass(endpoint, bookedDevicesIDs[i])).start();
}
}

private Runnable getTestCaseClass(final URL endpoint, final BookingDtoDevice dto) {

// this will give a Thread Safe TestScript class.

// You may also like to have this as a named class in a separate file
return new Runnable() {
@Override

public void run() {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setBrowserName(“chrome”);
capabilities.setCapability(“newCommandTimeout”, 600);
capabilities.setCapability(“deviceName”, dto.capabilities.deviceName);
capabilities.setCapability(“platformName”, dto.capabilities.platformName);
AppiumDriver driver = new AndroidDriver(endpoint, capabilities);
// Your Test Script Goes Here…
}
};
}

C. Run on IOS

public void runExecutionOnPCloudy() {
Connector pCloudyCONNECTOR = new Connector();

// User Authentication over pCloudy
String authToken = pCloudyCONNECTOR.authenticateUser(“uttam.kumar@sstsinc.com”, “sadf5sd5fds5sfd5a5fdas1”);
ArrayList selectedDevices = new ArrayList<>();

// Populate the selected Devices here
selectedDevices.add(MobileDevice.getNew(“Apple_iPad2_Ios_7.1.2”, 70, “iPad2”, “iPad 2”, “ios”, “7.1.2”, “Apple”));

// Book the selected devices in pCloudy
        BookingDtoDevice[] bookedDevicesIDs = pCloudyCONNECTOR.bookDevicesForAppium(authToken, selectedDevices, 5, “friendlySessionName”);
System.out.println(“Devices booked successfully”);

// Upload apk in pCloudy
PDriveFileDTO pDriveFile = pCloudyCONNECTOR.uploadApp(authToken, new File(appPath));
System.out.println(“ipa file uploaded successfully”);
pCloudyCONNECTOR.initAppiumHubForApp(authToken, pDriveFile);

// Get the endpoint from pCloudy

URL endpoint = pCloudyCONNECTOR.getAppiumEndpoint(authToken);
System.out.println(“Appium Endpoint:” + endpoint);

// Create multiple driver objects in multiple threads
for (int i = 0; i < bookedDevicesIDs.length; i++) {
Thread.sleep(5000);
new Thread(getTestCaseClass(endpoint, bookedDevicesIDs[i])).start();
}
}

private Runnable getTestCaseClass(final URL endpoint, final BookingDtoDevice dto) {
// this will give a Thread Safe TestScript class.
// You may also like to have this as a named class in a separate file

return new Runnable() {
@Override
public void run() {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“newCommandTimeout”, 600);
capabilities.setCapability(“launchTimeout”, 90000);
capabilities.setCapability(“deviceName”, dto.capabilities.deviceName);
capabilities.setCapability(“browserName”, dto.capabilities.deviceName);
capabilities.setCapability(“platformName”, “ios”);
capabilities.setCapability(“bundleId”, bundleId);
IOSDriver driver = new IOSDriver(endpoint, capabilities);
// Your Test Script Goes Here…
}
};
}

2. Rest APIs if needed to be used in platforms other than Java

https://s3.amazonaws.com/pcloudy-content-distribution/v2/API_USAGE_V2.pdf

Avinash
Avinash

Avinash Tiwari is a thought leader, a recognized keynote speaker, and the co-founder of pCloudy.com. He has 15+ experience in Product development and Testing. He brings with him a passion for emerging technology and quick adoption, both of which have solidified his reputation as a leader in the mobile app testing field.

Discussion

Leave a Reply


Can't read the image? click here to refresh


Read more Articles

September 24, 2021
How to Choose The Right Automation Testing Tool

Test automation is gradually taking over manual testing as it saves time and improves the quality of testing. Especially in the case of regression testing, automation can improve efficiency by manifold times. It is a waste of time and resources…

Learn More Arrow

February 12, 2021
Automation Testing Challenges and Their Solutions

Automation testing can be a highly effective productivity booster and quality enhancer for both, your product pipeline and system development projects if implemented correctly. However, it can be a tedious task to apply the best practices when a team is…

Learn More Arrow

April 19, 2020
What’s New In pCloudy 5.6?

pCloudy is committed to delivering the best solutions in mobile app testing and therefore we come up with product updates at regular intervals. This time we are thrilled to announce the release of pCloudy 5.6 with exciting new features to…

Learn More Arrow

Experience pCloudy Today

Tickmark No Credit Card Required
Tickmark Exceptional Security

Copyright All Rights Reserved © 2021