? QA Design Gurus: Automation Tool
Showing posts with label Automation Tool. Show all posts
Showing posts with label Automation Tool. Show all posts

May 10, 2016

Eleven Web UI automation best practices for better results

A few best practices for Web UI automation:

1)Having better Setup and Cleanup code

                Make use of better and stable Setup and cleanup that executes before and after the test execution respectively. This helps to avoid most of the dependency issues and provide robustness to your tests. As a example making use of REST or SOAP services to as setup and cleanup code will ensure the stability of the tests.

2)Identifying an element with stable property

                With the adoption of agile methodology and Cloud based applications most of the Web UI changes frequently to attract customers. This results in failure of Automated tests. To overcome the issue, Identify the element in the UI with more stable property. Using Dynamic ids are tag index will result in instability of the tests.

3)Making use of Reusable components

                Consider making the reusable steps as Utilities or functions, which results in faster development and maintenance of tests. Making the fix failure in the function results everywhere it is being used. Initial days of Automating a UI may not have utilities or it is difficult to decide whether to make set of actions as utility or not. Moving to further development utilities grows in incrementally and adds value to the development. Reusable components should be thoroughly tested since it will be used by multiple tests.

4)Better usage of Wait Statement

                Identifying an element may fail since the finding logic may have executed before the entire UI is loaded. So Simply using Wait statement may not be wise idea. Better to wait for a particular element in the UI rather than standard Wait statement. This ensures that following steps will be executed only after the UI is loaded.

5)Improving the readability of Tests

   Readability can be improved in many ways, below are listed few:

·         Keep the tests simple and short.
·         Name the test case such that it will reflect the purpose.
·         Provide better and meaning full names for the Elements in Element Repository.
·         Identify Element in UI with minimum set of properties.
·         Provide better name to step.

6)Consider different ways of identifying an element

                Conventional way of identifying an element using Element property directly may not work or there may be multiple elements with same property in such cases, trying the alternate ways may lead to better results below are few:

·         XPath: This can be used to find the relative location of an element if the element is not unique.

·         JQuery : We can perform complex browser actions using JQuery where conventional methods may not work.

·         Parent–child: Sometimes child element may not be unique, considering parent tag and navigating to child may result in uniqueness and stability.

7)Maintain Element Repository Globally

Make sure that Elements in the element repository is unique and reuse where ever required this makes easy maintenance and fixing of the test. Fixing a single element will be reflected in all the places it has been used. Though this have negative impact such as duplicate entries of elements, searching an element this can be overcome by following some conventions for the Elements.

8)Make use of services in UI Automation where UI Automation is not mandatory

Can make use of services like REST or SOAP which can perform some action that is not mandatory to test using Automation tool. This makes tests shorter and increase reliability, since the services are more stable than UI.

9)Scenario based testing over functionality based testing

Develop the test based on the scenarios that will cover the multiple functionality of the elements. Unit tests will ensure that basic unit part of the code is working fine hence focusing more on the scenarios that covers multiple functionalities will result in wider coverage of tests.  

10)Generating Custom Report for better debugging

Make use of Report generated by the tools if found that is difficult to debug. Develop the Custom report such that it will ease the debugging time.

11) Keep tests to a reasonable length


As a fact that long tests takes more debugging time considering shorter ones. It is better to keep the tests short and simple.


Mar 30, 2016

Be a QA


Quality Assurance (QA) ensures the quality of the product and focus on giving confidence for the release. As a person, it is good to have a few qualities which will help us to excel in our job.
Let me give my version of QA.

QA means Questions & Answers:
Questioning is very important in our life. If we want to buy a product, we ask a lot of questions and will know about the product completely and then take the decision. And, if you are a seller, providing proper answers are also equally important to sell the product.
In the same way, QA has to ask questions whenever there is a feature discussion or in any meetings. And, as a QA provide various kinds of answers when a customer asks questions.

The best way to achieve this is to be active in Community/Forum where we get to know various kinds of questions as well as answers.
Bottom Line: Ask as many questions as possible, provide as many answers as possible

QA means Quick & Automate:
In this busy life, we have to take decisions quickly to resolve issues. For example, if we have a problem in our family, we have to work on it as soon as possible before it gets bigger.

In the same way, if we found any issue in the product or process then raise it immediately without any delay. And, learning the things quickly will give us ample time to look into other activities. If you pay attention in whatever you do, then quick learning will automatically happen.

Software testing has a huge scope and it contains a lot of testing types. It is not easy to say ‘We are ready for Production’ without doing enormous work. We have to take care of each and every testing type and ensure that everything is working fine.
How can we test all testing types within a given period of time to certify a build?
The only way to achieve this is using a weapon called ‘Automation’.
Automation helps us to do our existing tasks quickly and it allows us to explore new things.

Let me give an example to illustrate the same.
We want to travel from a source to destination.
We decide to take a vehicle based on the distance that is there in between. For example, if we want to travel to the USA, we catch the flight. If we want to travel within India, we have a few more options along with flight.
So, we use a vehicle to reach our destinations quickly.

In the same way, if we use a vehicle called automation in our software testing then we can reach our destinations called deadlines successfully without any issues. And, we can save a lot of time and effort if we do automation. As a QA person, we have to take a decision on which tool we need to use based on our testing category.
Bottom Line: Be quick in every action and try to automate everything that is coming in your way
So, what are you waiting for?
Be a QA person in both personal and professional life!!!

Mar 25, 2016

What is SikuliX

What is SikuliX?
Sikuli is a GUI Automation tool which works on Visual Image Match method. Simply saying we can automate anything that we see on the screen.
Besides locating images on a screen SikuliX can run the mouse and the keyboard to interact with the identified GUI elements. This is available for multi monitor environments and even for remote systems with some restrictions.

How Sikuli Works
Sikuli Script is a Jython and Java library that automates GUI interaction using image patterns to direct keyboard/mouse events. The core of Sikuli Script is a Java library that consists of two parts: java.awt.Robot, which delivers keyboard and mouse events to appropriate locations, and a C++ engine based on OpenCV, which searches given image patterns on the screen. The C++ engine is connected to Java via JNI and needs to be compiled for each platform. On top of the Java library, a thin Jython layer is provided for end-users as a set of simple and clear commands. Therefore, it should be easy to add more thin layers for other languages running on JVM, e.g. JRuby, Scala, Javascript, etc.





What we can automate?
Simply saying we can automate anything that we see on the screen.
1. Windows based application
2. Flash objects (such as automating Flash Games)
3. Adobe Audio/Video Player.

Advantages:
1. Sikulix is Open Source
2. Sikuli IDE gives enough API's to interact with desktop based applications. Adding on to that we can use most of the API's of python scripting as well. Which totally depends upon how we code basically.
3. Picture recognition in case of Sikuli is pretty much accurate
4. Useful if the application demands so much of interaction from the user.

Drawbacks:
1. Dedicate machine should be provided (When Sikuli scrpits are running, user cannot use the Same machine for doing other things because mouse/keyboard events will effect the image verification.)
2. Overhead of taking images
3. Requires real screen.

Prerequisite:
Valid Java installation

Supported Operating Systems:
Windows XP and later including Windows 8 and 10 (32-Bit or 64-Bit)
Mac OSX 10.6 and later including 10.10 and 10.11 (64-Bit only)
Linux/Unix systems depending on the availability of the prerequisites (32-Bit or 64-Bit)

Mobile support:
Though SikuliX is currently not available on any mobile device, it can be used with the respective emulators on a desktop computer or based on VNC solutions.

Supported Scripting languages:
Python (language level 2.7) supported by the Jython interpreter.
Ruby (language level 1.9/2.0) supported by the JRuby interpreter.
JavaScript supported by the Java builtin scripting engine (Java 7: Rhino, Java 8: Nashorn).

Integration with current automation tools
Selenium Webdriver
Robot framework

Useful links
http://www.sikulix.com/
https://launchpad.net/sikuli/+download
http://www.sikulix.com/quickstart.html

Other Image based automation tools
Eggplant, RoutineBot, Ranorex


Feb 8, 2016

TTS Tips: Explicitly adding element to element repository and understanding it's auto generated meta data



There are mainly two ways to add element to element repository:
1. By recording test step (See my post about this here)
2. By adding element explicitly to element repository

There are two ways to explicitly add element to element repository:
A. From the browser
B. From the recorder

A. From the browser:

To do this, first we have to select "Highlight Element" in the recorder. Once it is done, we should able to highlight the elements in the browser.

Do following steps to add element to element repository,
a. Go to required element and mouse over it then you should able to see list of options.
b. Select Add to Elements, then friendly name pop-up will be populated.
c. Enter friendly name and click on Add Element.


B. From the recorder:



Do following steps to add element to element repository,


a. Go to recorder and search for required element in the DOM.

b. Right click on the DOM and select "Add to Element Repository", then friendly name pop-up will be populated

c. Enter friendly name and click on Add Element.




We can use this added elements to crate record test step(regular test step). As recorded test step is created from element repository element, the element will not be deleted when we delete recorded test step. By adding element explicitly, if any coded step interacted with this element doesn't causes test case failure. These type of elements should explicitly delete by us from element repository. In the auto generated meta data file (.tstest), you can find these type of elements under "IndependentDescriptors".






We can do required updates here, they will reflect on element repository.


The advantage of first approach is, we no need to worry about element repository clean up where as in second approach, we have to spend some time on element repository clean up if required. Anyhow, in both cases, if we delete test case then the elements bounded with that case will be deleted automatically from element repository.