Monday 31 December 2018

How to Connect Zephyr For Jira Programmatically (ZAPI)

Jira by default is a 'Defect Management Tool'. However, available add-on for Jira make it much more capable than just defect Management tool. Couple of such add-ons like 'Zephyr For Jira' & 'ZAPI' (API to access data from 'Zephyr For Jira' programmaticallymake Jira capable for 'Test Management'. Both of these add-ons have different version for Server & Cloud accordingly. Let us look at, how do we work with ZAPI server version.


Use Case: Whenever the automation is run, it has to update the status of execution in test cycle.

Pre-requisite: Manual Tests are created in Jira with Issue Type - Test & Test cycle is created with tests added into it (Adding tests into test cycle creates execution ids for each test case in test cycle).

High Level Steps:
  1. Login to Jira using proper credentials.
  2. Provide the Cycle Id OR ProjectId,Version & Cycle Id of the Test cycle to ZAPI api.
  3. Update the Test case status in test cycle based on the execution id of each test case.

Example to Update Status of Test case execution Using ZAPI API:


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

Friday 14 September 2018

How to run Chrome & Firefox Webdriver in Headless mode

Headless Browser! What does it mean.? As name suggests, It is a browser without head.i.e., without GUI. 

Headless Browsers are a kind of simulation programs of real browsers, but without GUI. Having said that, these may not be 100% equal to real browsers as they have its own limitations. Here are few popular headless browsers:

  • Headless Chrome
  • Headless Firefox
  • HtmlUnit Driver
  • PhantomJS
  • SlimmerJS

Headless browsers come with its own Pros & Cons.
Pros:

  • Improves the execution speed,in turn increases the performance.
  • Can be executed on Browser-less setups like Servers(without browsers).
  • Useful while scraping the web.
  • Simulate multiple browser versions on a single machine.

Cons:

  • It doesn't mimic the real user.
  • Debugging is quite difficult.

Below snippet would show you, How to make Chrome & Firefox work in Headless mode.

Friday 7 September 2018

Compare Images in Selenium Test

Visual / UI Validation of web pages across different browsers & devices is very important these days as more and more applications are getting web enabled. And most of the websites are eyeing on 'Responsive Web Design' to create a single website across multiple resolutions.

This type of testing is usually performed manually. However, now you can automate these type of tests to an extent using different image comparison libraries like Thumbnailator, Slenium-Shutterbug, ImageMagick Applitools Eyes etc.

Using these libraries, both Functional Testing & Visual Testing can go hand-in-hand without having to maintain separate set of scripts.
One such example using Image-comparison.jar based on Thumbnailator library is as below:


Steps:


Wednesday 5 September 2018

Capture Full Screenshot in Selenium using Shutterbug


Selenium with the new upgrade 2.0 to 3.* had changed the way it works in the background. Starting with this upgrade, FirefoxDriver has stopped taking the full screenshot. There are many instances where user needs complete screenshot of the web page.
Many teams have worked on it & provided few open source libraries like AShot, ShutterBug etc.

Below code snippet would enable you to get the full screenshot using ShutterBug java library.

STEPS:


Capture Full Screenshot in Selenium using AShot


Selenium with the new upgrade 2.0 to 3.* had changed the way it works in the background. Starting with this upgrade, FirefoxDriver has stopped taking the full screenshot. There are many instances where user needs complete screenshot of the web page.
Many teams have worked on it & provided few open source libraries like AShot, ShutterBug etc.

Below code snippet would enable you to get the full screenshot using AShot java library.

STEPS:


Wednesday 25 July 2018

Native 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 Native App using AndroidDriver.

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 'TestNativeApp' to add the automation code.
  3. Connect your device(USB debugging enabled), to system's USB port & accept if any confirmation pop ups.

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.