My Blog List

Tuesday, December 5, 2017

Robotic Process Automation vs Traditional Test Automation vs Process/Task Automation

In IT industry, the term RPA is keep on hearing all sides of the walls for a while; and I was so confused about What's the difference from the test automation tools in the market and what's more into it. I did some search, understanding, and writing this post to share with you all. If I am not correct, PLEASE correct me.

Traditional Test Automation:
First, we have to recall the test automation tool QTP or UFT (Initially developed by Mercury Interactive Corporation(MIC) after WinRunner, then sold to HP, and again MicroFocus acquired from HP now). If you look into the architecture of this tool, MIC was trying to convert the testers into more efficient testers i.e. Testers were executing the test cases manually for regression suites, performance suites, etc. which had lot of repetitive tasks done by human testers instead of concentrating into new ideas or bug finding strategies to improve the quality of the product. 

Thus WinRunner was introduced but it was demanding more technical users to handle or write code in C language, and they introduced QTP in which user can code using simple VBScript and also easy to learn VBScript compared to C.

Even after introduced these kind of tools, human testers need to code or should have little technical knowledge to handle these kind of tools in the market, and they were trying to help them by introducing design strategies like Keyword approach. Keyword approach was helpful at some level and still lot of companies are using this approach utilizing Business Analysts to test using the developed keywords but yet we need technical users to develop these keywords.

Robotics Process Automation:
Now, in the current era, we are trying to minimize (not omit) the demanding of technical users to design an automated test and the result is RPA. RPA have the capabilities to utilize non-technical users to design some test easily and run it. 
How he will design?

The RPA tool provides all the necessary API required to mimic the operations on the Application Under Test like how a manual tester would do. So, there is now need to write the code or technical need here; the user just need to create the test by selecting the control, what kind of action need to do on that control, what is the test data, etc. and can run against multiple platforms, form factors, etc.
So, we can say RPA is next iteration of existing test automation tools; in which they were trying to achieve the same too. But some RPA tools are claiming that they are doing AI too.

Based on my search, I didn't find any RPA tools which is really doing AI .i.e the tool itself has do take decisions of assertions, situations of conflict, etc. Instead, some tools are doing multiple locating strategies to find UI elements like ID, class, Xpath, Css, Image based, Text Based and location based. If one fails, follow next kind of strategy which I would assume is not an AI feature.

Yes, I can hear the questions: How an automated test is possible without minimal technical knowledge or coding skills?
Yes, It is not possible and yet the test designers required to have minimal coding knowledge like handling logic, loops, variables, etc. and should keep on evaluating themselves to acquire good/reliable set of automation suites to run.

Is current RPA tools are completely code-free?
Yes, to some extent. Yet, like we discussed, you cannot handle all the situations in your AUT in simple manner while designing your tests; and yet tools should have platform to design your own code and to include them as part of the test. So, adaptability, utilization of existing code, etc. are great attributes for any RPA tool.
And of-course, the tool should have the capability to integrate with different Source Control systems, CI systems, and features supported by today's leading tools.

Process/Task Automation:
As you are aware of, already lot of automation tools been supporting these type of automation like File Oprations, DB Operations, scheduling, etc. and these type of process or task automation will demand less or no UI automation. This can be achieved using any automation tools with coding platform and this is so efficient based on the programming language you are using.

Here, we should not confuse the Business Process Management with any of these automation. BPM is a way of organizing the steps, workflow of an process or task or testing approach; and you can utilize automation code to automate the business processes.

Still I have this question in mind: If RPA tool is incorporating AI features, what kind of ideas can have this RPA tool? I am thinking that the human is required to elevate a decision based on real-time priorities, functional changes, business requirements, etc.and how an AI tool will include these as part of their decision making process?
To work as AI, the robot needs to understand the system and the decisions we took earlier i.e. the history of data to teach self and learn. So, to utilize the AI feature, again humans need to feed these kind of data if exists or teach some decisions by configuring it. :)

Leading RPA Tools in the market today in 2017:
Automation Anywhere, Blue Prism,, UIPath, etc.

Disclaimer: I took WinRunner or QTP for example only.

Wednesday, March 22, 2017

Triggering UFT/QTP Tests from CI Tools (outside of ALM/QC)

In the CI (Continuous Integration) world, we would be in the position to trigger UFT/QTP scripts from outside of ALM/QC and there we may have 2 options like;

1. Running UFT tests stored in plain Windows File System folder
2. Running UFT tests stored in ALM

Both these options are being utilized by lot of testers effectively and working great. Here I would like to give some light on what if we need to update results to particular test set instance in ALM while triggering tests from outside of ALM. 
You should have seen the result options in the dialog which pops up when we are trying start running from UFT/QTP itself and we will select the option and hit OK to start running. Here we need to select those options from API.


Sub LaunchAndRunUFT()
    Dim oUFT, appUFTResults, uftTestParamDef, uftTestParams, oFSO
    'Launch UFT
    Set oFSO = CreateObject("Scripting.FileSystemObject")
    Set oUFT = CreateObject("QuickTest.Application")
    Set appUFTResults = CreateObject("QuickTest.RunResultsOptions")
    oUFT.Visible = True
    'Connect to ALM
    If Not oUFT.TDConnection.IsConnected Then
        oUFT.TDConnection.Connect "ALM URL", "ALM_DOMAIN", "ALM_PROJECT", "ALM_UserID", "ALM_Password", False 'True if it's encrypted password
    End If
    'Open the test
    oUFT.Open "[ALM] Subject\MYTestInALM", True
    'Set params and run
    Set uftTestParamDef = oUFT.Test.ParameterDefinitions
    Set uftTestParams = uftTestParamDef.GetParameters()
    uftTestParams.Item("MyTestParameter").Value = "ValueToPass" 'if you want to pass Test Parameters

    'appUFTResults.ResultsLocation = "" 'if you are storing in Windows File System
    appUFTResults.TDTestSet = "Root\TESTSET_FOLDER\TEST_SET"
    appUFTResults.TDTestInstance = 1
    oUFT.Test.Run appUFTResults, True, uftTestParams
End Sub

.Net (C#):

public void LaunchAndRunUFT()
            //Launch UFT
            System.Type uftType = System.Type.GetTypeFromProgID("QuickTest.Application");
            dynamic oUFT = System.Activator.CreateInstance(uftType);
            oUFT.Visible = true;

            System.Type uftResultType = System.Type.GetTypeFromProgID("QuickTest.RunResultsOptions");
            dynamic oUFTResults = System.Activator.CreateInstance(uftResultType);

            //Connect to ALM
            if (!oUFT.TDConnection.IsConnected)
                oUFT.TDConnection.Connect("ALM URL", "ALM_DOMAIN", "ALM_PROJECT", "ALM_UserID", "ALM_Password", false);

            //Open the test
            oUFT.Open(@"[ALM] Subject\MyTestInALM", true, false);

            //Set params and run
            dynamic oUFTTestParamDef = oUFT.Test.ParameterDefinitions;
            dynamic oUFTTestParams = oUFTTestParamDef.GetParameters();

            oUFTTestParams["MyTestParameter"].Value = "ValueToPass";

            //appUFTResults.ResultsLocation = ""
            oUFTResults.TDTestSet = @"Root\TESTSET_FOLDER\TEST_SET";
            oUFTResults.TDTestInstance = 1;
            oUFT.Test.Run(oUFTResults, true, oUFTTestParams);



Wednesday, December 28, 2016

Generate Test Execution Report with Screenshots inbuilt

How to generate HTML report with inbuilt screenshots?

Lot of automation testers would come across this path while trying to integrate their automation solution with some test management tool or trying to send the execution report to management team. The main issue we face here is that we need to attach the screenshots also while sending or uploading into another tool.
What would you think if we can convert the image into bytes and store it inside the HTML itself?
Yes. You are right. We can attach the screenshots and report statements in one single html file and easily we can attach or send it to anybody.

Function convertImageToBytes(strScreenshotFilePath)
  Dim streamInput, bytesStream, oDOM, tmpElement
  Set streamInput = CreateObject("ADODB.Stream")
  Set oDOM = CreateObject("Microsoft.XMLDOM")  
  streamInput.Type = 1  ' adTypeBinary
  streamInput.LoadFromFile strScreenshotPath
  bytesStream = streamInput.Read  
  Set tmpElement = oDOM.createElement("tmp")
  tmpElement.dataType = "bin.base64"
  tmpElement.nodeTypedValue = bytesStream
  convertImageToBytes = "data:image/png;base64," & Replace(tmpElement.text, vbLf, "")
End Function

You can get this content and assign to some attribute in html; and you can utilize it to build some logic around it to show the screenshot.
You can get lot of examples for this html logic in w3schools.

Tuesday, April 19, 2016

Sample Cucumber with Java

Most of us should have heard about the term BDD - Behavious Driven Development. In this post, I would like to give some intro about familiar BDD framework called Cucumber and why we need BDD.

Why BDD?
Once people started moving to Test Driven Development (TDD), it helped a lot interms of reducing the bugs in development stage itself as every feature was developed by creating smaller unit tests, making it FAIL and coding the functionalities to make it PASS.

But eventually, the BAs and testers are not able to follow these testing practices and thus gap in communication which lead to lot of mis-understanding the features/requirements.

So, experts wanted a framework which should take inputs like normal people speaking English and should run the tests based on those requirement. Also this requirement will support as documentation of features to understand by testers/BAs/devs. Thus BDD was born.

BDD keywords:
Given, When, Then and And


Scenario: Login to Facebook
 Given Facebook login page
 When I enter valid username and passowrd
 Then I should see my home page
 And I should see my name

If you see above scenario, this will act as requirement as well as documentation. We are using this feature scenarios and connecting each steps to our own selenium steps written in java or any other language and running it.

To understand the .feature files and options that we can use for different way of execution, control, etc., read this documentation.

You can find the sample project and start learning on your own.

Friday, April 15, 2016

Continuous Integration, Testing and Delivery

Based on the knowledge gathered from QA and DevOps experts, presenting a simple graphic which represents how actually the CONTINUOUS delivery works. Also this will help to differentiate each from other.

Monday, March 28, 2016

Selenium - TestNG - Jenkins Integration

As current agile development process keep on expecting more testing with continuous integration stuff, I am going to give brief summary about how we can integrate the CI process with Jenkins.

1. Your Selenium project
2. Your Selenium and TestNG lib locations
3. Jenkins installed. Ensure IIS in your machine installed and you can access Jenkins Dashboard using http://localhost:8080/

Before creating a job under Jenkins, try to run your selenium tests from command line.

Selenium - CommandLine:

Let's say, you have project called SeleniumProject under C:\Eclipse folder. Assume you have all your JAR files (Selenium Jars, TestNG Jars, etc) under C:\Eclipse\JARs folder.

Now you can prepare your command.

1. Go to Project location
cd "C:\Eclipse\SeleniumProject"

2. Execute your testng.xml suite by setting the requied class path.
java -cp "bin;..\JARs\*" org.testng.TestNG testng.xml

-cp means class path
bin - bin path to look into class files to execute
..\JARs\* - to refer the JARs location and to include all JARs
testng.xml - assumed testng.xml file is under the project folder

Now it should run the tests. If working fine, then you can update the command in Jenkins.

Jenkins Job:

1. Go to Manage Jenkins --> Configure System and set the JDK installation path.
2. Create New Item of type Freestyle project
3. Under Build section, add build step of type Windows Execute Batch Command
4. Provide your commands and Save.
cd "C:\Eclipse\SeleniumProject"
java -cp "bin;..\JARs\*" org.testng.TestNG testng.xml
5. Now you can run and test.

Go to your newly created project and click Build Now. You can see the build process running and see the output.

Monday, June 8, 2015

Handling Objects not recognized as standard type

While doing automation on UI, we will face lot of scenarios like Object not identified as expected type and will scratch our head how to simulate such object set, click, etc.

We have some options to simulate actions on such controls using WScript.Shell or Mercury.DeviceReplay
The only thing, we need to instruct the those APIs at whichposition exactly it need to perform the actions.

You can do with absolute poistion:
x = yourObject.GetROProperty("abs_x") + (yourObject.GetROProperty("width") / 2)
y = yourObject.GetROProperty("abs_y") + (yourObject.GetROProperty("height") / 2)
Set MerRply = CreateObject("Mercury.DeviceReplay")
MerRply.MouseClick x + 5, y, LEFT_MOUSE_BUTTON

You can use relative position:
x = yourObject.GetROProperty("width") / 2
y = yourObject.GetROProperty("height") / 2
yourObject.Click x, y, LEFT_MOUSE_BUTTON

If you want to type on the controls, simulate the type using SendKeys followed by click action.