Friday, 22 June 2018

Data Generation using Java

Data Generation in Test Automation is one of the tedious task which consumes lot of time before the start of execution. So, Why provide the data required for Automation manually? Automate it. !!

Having said that, it is not so easy to address every requirement with single solution. In the below example, i am trying to address few of the generic use cases which will let us automate the data creation. 

NOTE: 

  • Below sample uses 'Xegeran automation library to generate text from regular expressions.
  • Apache commons RandomStringUtils class to generate the random text.


Below example will let you know the way to generate the Random strings of different types.


public class RandomTextGenerator {

Thursday, 31 May 2018

Web App Automation using Appium

In the Mobile world, we see multiple types of apps namely Native App, Hybrid App & the browser based application, Web App. Also, we see multiple types of operating systems like Android, iOS, Windows, Firefox OS etc.

Automated testing of these many variation of apps, is very tricky & difficult task. Not all of them are supported by single automation tool. Having said that, Appium which is built over Selenium webdriver supports most of the OS & apps with different configurations.

In this article, you would know a way to automate the mobile web app using RemoteWebdriver.

Prerequisites:

  1. Android SDK is downloaded and installed. (ANDROID_HOME env. variable should be set)
  2. Either Emulator or  Real device (USB debugging enabled) is available.
  3. Appium desktop app or non GUI package is installed. 

Steps:

  1. Create a java project in eclipse 'AppiumMobileTesting'.
  2. Create a class 'TestWebApp' to add the automation code.

Sunday, 29 April 2018

How to Avoid Certificate Popups to enable smooth Automation


Certificate Popups are common in a secured environment or while accessing the internal applications. It is a basically a way to authenticate the users accessing the application.

Yes, I know..! This is annoying for automation testers.
To overcome this annoying feature and yet without compromising on security, we have to make certain settings on each browser. These settings enable us to have smooth automation.

The fix is very simple, let the browser know which certificate to select as default one. Thus stops asking you for a client certificate. Follow the settings mentioned below based on the browser:

NOTE: 
  1. This approach will help when you have no or only single certificate added to browser.
  2. This approach is tested on windows OS.

Mozilla Firefox:

Step 1: Import Certificate

  1. Open Firefox > Options > Certificates > View Certificates > Your Certificates.
  2. Click Import & follow instructions to import a certificate(*.pfx)
  3. After Import, Success Message will be popped up.

Thursday, 21 December 2017

Connect Jira from Java using Jira REST API


Jira is one of the popular bug tracking tool developed by Atlassian. It also provides project management features inline with Agile methodology. Jira is basically written in Java & can integrate with source control programs like Perforce, Git, Clearcase, Subversion, TFS etc.
It also provides robust set of APIs which enables its integration with any system.

An interesting fact about its name 'JIRA': It is not an acronym, but a truncation of 'Gojira', the japanese name for 'Godzilla'.  :)

Example to Create Issue & Search Issue:

This example shows how to consume Jira REST APIs from Java using REST Assured libraries.

Step 1: Create a Project with dependent REST assured libraries.

NOTE: For the set up / usage of REST assured libraries can be found in another post.
https://advancedtestautomation.blogspot.in/2016/08/test-rest-web-services-using-rest.html

Thursday, 7 December 2017

Selenium Tips and Tricks


Get the DOM Object into View:


At times, few actions are not performed on a DOM object until it is visible in the view-port. Below is the small code snippet to get the DOM object into view using WebDriver's 'JavascriptExecutor' interface. 

WebElement element = driver.findElement(By.id("someId"));
JavascriptExecutor js= (JavascriptExecutor) driver;
js.executeScript("arguments[0].scrollIntoView(true);",element);

OR

((JavascriptExecutor) driver).executeScript("document.getElementById('text123').scrollIntoView(true);");

Selenium WebDriver Wait Commands:

For any automation scripts to work without any sync issues with application, wait statements are very important. Selenium WebDriver provide different types of Wait conditions to make automation scripts effective.

Below are different types of waits & its usage.

Thursday, 28 September 2017

Validate Website Performance using Google PageSpeed Insights

Google has developed a set of website Performance Optimization tools called 'Google PageSpeed'. It has 4 main components: PageSpeed Module, PageSpeed Insights, PageSpeed Service and PageSpeed Chrome Extension. These tools are built to idetify the flaws in website’s compliance with Google’s Web Performance Best Practices.Also, automate the flaw correction process.

PageSpeed Insights:


An online tool helps in identifying performance score on any website and provides suggestions on optimizations to make website faster. This can be accessed directly in any browser. It provides the webpage performance score on a scale from 0 to 100 for each url request, provides a report on suggested optimizations. It provides specific score for mobile & desktop & corresponding suggestions.

The scores fall under the below 3 categories:
Good: The page applies most performance best practices and should deliver a good user experience.

Needs Work: The page is missing some common performance optimizations that may result in a slow user experience.

Poor: The page is not optimized and is likely to deliver a slow user experience. Please prioritize and apply the recommendations below.

Monday, 17 July 2017

Integration of Selenium + Sikuli

Sikuli is a tool using Visual Recognition capability which automates anything seen on the screen of your computer running Windows, Mac, few Linux/Unix OS systems. It uses Image recognition powered by OpenCV to identify the GUI components.

The version of Sikuli is named as 'SikuliX'. It also comes with basic text recognition (OCR) feature to search text within images.Besides locating images on screen, it can handle mouse & keyboard events to interact with GUI elements. 

Friday, 19 May 2017

Selenium for Angular JS Pages


Selenium + NgWebDriver  =  Better AngularJS Support

Angular JS is a opensource web application framework based on Java-script. Any Angular JS implemented web page would have additional custom tag attributs like ng-app, ng-model, ng-bind, ng-repeat etc.

Automating the AngularJS based web application is possible using Selenium. However in certain cases where the web pages are built extensively using AngularJS  resulting in complex DOM structure, it is difficult to locate DOM elements with simple XPaths & CSS selectors.In this case, Protractor (an E2E test framework for Angular Applications) built on Java script version of Selenium makes it easy for identifying the locators easily.

Sunday, 19 March 2017

Voice Driven Testing using Perfecto Mobile

Most of the applications today started supporting voice commands either it is a desktop or a mobile.More & more functionalities are being supported by voice commands.

Testing these functionalities is very difficult as it requires audio files which are hard to edit / maintain them whenever required. Perfecto has come up with a better way to test these functionalities.

Steps to test Voice Driven Functionalities:
  1. Enter required text
  2. Convert Text to Audio
  3. Inject the generated Audio to application

Wednesday, 25 January 2017

Seamless Integration of Selenium + AutoIT

AutoIT is a freeware available to automate Windows GUI by simulating the combinations of mouse movements & key strokes. AutoIT has its own basic syntax, editor & control identification mechanism. However, to achieve the code level integration one can use 'AutoItX', packaged with AutoIT. This supports access to AutoIT functions using COM objects.

Monday, 16 January 2017

Extract Text & Images from PDF


Extracting text from PDF is not as simple as reading text from a text(.txt) file. One has to use suitable libraries to extract data from any pdf file. For example, Below code snippet shows one of the way to extract text or images from PDF file using Apache's PDFBox libraries.

Thursday, 24 November 2016

Visual / UI Test Automation using Selenium and Applitools Eyes

Visual / UI Testing is a methodology for validating the multiple visual aspects of Websites, Mobile apps and Desktop apps across multiple browser, resolution and OS combinations.

Visual / UI Testing is very important these days as more and more applications are getting web enabled. (i.e more of the standalone applications are being converted into websites) & most of the websites are eyeing on 'Responsive Web Design' to create a single website across multiple resolutions.The mobile apps designed for a platform has to support multiple screen resolutions or devices.

This type of testing is usually performed manually. However, now you can automate these type of tests using different automation tools available in the market. One such automation tool is Applitools Eyes which has the advantage of validating visual aspects within the existing Selenium scripts.

Friday, 28 October 2016

JDBC-ODBC Bridge support in Java 8

JDBC-ODBC Bridge offered lot of flexibility in connecting a data source. Many had used this bridge to connect & query MS Excel / MS Access as a database. Starting from Java 8, Oracle has removed this feature. This created a major blocker for many to upgrade to new Java version & many applications which were built based on this have failed.

As an interim solution, one can build an extension from jdbc classes of previous java version & add it to Java 8 extensions.

Follow the below steps to enable the JDBC-ODBC Bridge support in Java 8.

Thursday, 27 October 2016

Selenium 3 Impact & Changes

Selenium is out with new stable version - Selenium 3.0.1, and this blog would detail out changes & impact the new version of Selenium brings into automation testing. 

Selenium 3, is believed to have major changes in its implementation & quite a few changes to the existing automation.In Sel-3, the original Selenium Core is being taken off & replaced with the alternative implementation that’s backed by WebDriver. It means, Selenium RC users would run into issues & might need to tweak their scripts to support new implementation. However, for web driver users it is believed to be a simple drop-in upgrade.

Jenkins REST API / Remote API


Jenkins is a open source continuous integration tool written in Java.
It is a server-based system running in a servlet container such as Apache Tomcat. It supports SCM tools including AccuRev, CVS, Subversion, Git, Mercurial, Perforce, Clearcase and RTC, and can execute Apache Ant and Apache Maven based projects as well as arbitrary shell scripts and Windows batch commands.

Jenkins has provided the flexibility of accessing it through code by exposing REST based API.