Saturday, October 19

Basic SpecFlow Automation tests in visual studio express using C# ,Selenium webdriver,nUnit console


Specflow is layer that would sit on the top of C# and one can specify tests cases in normal English readable format and build automation using these test cases. Writing test cases in format that is easily readable enables appropriate reporting and the direct mapping user story into automated test cases.Instead of digging down what test case is doing, here from reading the test case itself, it gives understanding of what it is about and what it is doing. Thus enables one to describe a test case on how the desired behaviour should be specified. 
Using above  behaviour specification structure one can write a story like
Feature: Google Search
As an end user,
I would like to visit the google search page
And then I would like to search an item so that
I can view the search results

Scenario: Google Search
Given I am on the Google home page
When I search for text Webdriver
Then I should see the search results with title WebDriver – Google Search

Sunday, October 6

How to invoke nUnit from Visual studio express and execute automation tests


nUnit is Unit testing framework tool for testing C# unit test cases. With the invent of selenium webdriver, this C# code intergrated with nUnit framework can be used to run acceptance tests. Simple way to integrate commands into Visual studio express to call nUnit tests is to use external tool feature.
Before that lets explore what options has nUnit has when you run it from a command line. Type ‘nUnit /help’ in command window which is in the directory where nUnit bin is pointing to, then it pops up below window .

Capturing screen shots using remote/local webdriver in C#/Selenium webdriver automation test cases

This blog provides details on how can you capture a screenshot using webdriver. You may run webdriver as remote webdriver or local webdriver . Both the webdriver has a method called GetScreenshot() which captures the screenshot of the browser’s current state. In tests it would be useful to capture the screen shot just to make sure the test has executed successfully or capture screenshots when error occurs. So this blog will provide you information on how basically one needs to make calls to these methods and you can use this code or learning from this code to implement it your framework.

How to invoke/run different type of selenium web driver browser using remote webdriver in C# automation scripts


Remote web driver feature in selenium is very advantages and helps to achieve distributed testing.  Distributed testing comprises testing different browsers on different machine and simultaneous run of tests  on number of machines. As a basic lets try to understand how we can we invoke a test case in different browser that is located on different machine using remote webdriver. Declaration for remote webdriver is as below for c# code
IWebDriver driver = new RemoteWebDriver(new Uri("http://127.0.0.1:4444/wd/hub"), DesiredCapabilities.InternetExplorer());

Wednesday, October 2

How to invoke locally different types of browser web driver using selenium and c# for test Automation scripts


This blog is in sequence to How to blogs related Selenium in C#. In previous blog of this series , we had created a basic web driver test . Different browsers have different webdrivers and invoking them is all nearly similar but there are slight changes.Of three main browsers – Firefox, Google Chrome and IE – firefox comes inbuilt. Hence in the test written in previous blog we could straight away start using firefox browser without downloading driver file.
As seen ,the statement below would be all just necessary to create instance of firefox browser.
IWebDriver driver = new FirefoxDriver();

The same statement for IE or Google chrome would not work as the driver files for these drivers are separate files and do not come embedded with selenium jar. For this one needs to download drivers for IE ( 32 bit or 64 bit ) and Google chrome . These are available from selenium at this location


Tuesday, September 3

Quality Center test instances /test cases that are blocked and corresponding linked defects

One time or the other during the test execution phase, one comes across a question on how to find the test cases that are blocked by defect. This is key because

1. It helps to identify the defects that are blocking the test cases and highlight them to defect management teams

2. It helps to identify any defects that are closed recently and would have been inappropriately linked to a test case.

Sunday, August 25

Quality center defect history – To track the defects that have undergone severity change

This blog is in response to comments from one of my previous blog. I was away from quality centre for long time and had not got the oppurtunity to reply to the comment. Now I feel I should blog about this if it could help someone else and I know how it can be done.

As mentioned in my previous blogs, history of any entity in the QC can be retrieved from AUDIT_PROPERTIES and AUDIT_LOG tables. In the previous blog QC History for closed defect – Status History, there is explanation on how to join these tables. I will quickly jump to main of query on how to retrieve defects that have undergone severity change

Friday, August 23

QC history for closed defect – Status History

For some defects one would like to know the status history of defect. This can be easily found in the QC when you click on particular defect and then click history tab. But if you want to have this information for multiple defects on single sheet or page, then Excel query option in the QC is the best option.

The AUDIT_LOG table has all the events registered for a entity and AUDIT_PROPERTIES TABLE has the details of these events.  Both these tables can be used to retrieve the history of any defect

Let’s try simple query to extract details for a particular bug. The bug id of BUG table is linked to AUDIT_LOG table with field AU_ENTITY_ID and hence create below inner join to begin with
SELECT * FROM BUG B
INNER JOIN AUDIT_LOG AL
ON AL.AU_ENTITY_ID = B.BG_BUG_ID

Wednesday, May 22

Https Recording with New Jmeter

Https traffic recording with Jmeter had been a issue for quite a long time. With recent version of Jmeter releases, it has tried to fill the gap on this shortcoming. It had previously https spoof until Jmeter version 2.6 which didnt quite work well with redirects etc. The latest release of Jmeter (currently 2.9) doesnt use this anymore. Jmeter https recording works normally. But for some URL's , it does work straight forward. Below are the steps that needs to be applied so that you can make sure Https recording works.

Sunday, May 19

Creating Basic Selenium web driver automation test case using Nunit and C#

To create selenium automated tests using C#, you would require nUnit and an IDE like VS express 2012 . To setup these, you can refer my previous blog on setup. In this blog article, I would write on how to create a basic selenium C# script and execute them on VS Express IDE itself.
At the end my previous blog,  you would have the code on VS express IDE as below

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace UnitTestProject1
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
        }
    }
}

How to setup C#,nUnit and selenium client drivers on VSExpress for Automated tests

Selenium can be used in conjunction with C# and Nunit to build robust automated test cases. This blog is one of the How to series on selenium-C# that help novice automation tester to learn and build automation test cases.
In this blog, I would be explaining the how to setup tools for Selenium web driver automation.
To build selenium webdriver automation test cases in C# and Nunit, you would require to setup

Monday, May 6

How to schedule Rational Performance tester(RPT) tests or execute them from command line

For some cases, one might find himself in a situation where in , he may require to schedule a test to run late night or later point in time. To achieve this with Rational Performance tester, it can be done by scheduling a window task to run a batch file(or crontab to run a shell script) containing the command line that execute the tests

Friday, May 3

Tips on Rational Performance Tester (RPT) Datapool

After all the time, being used to csv/excel files , when I had to face Datapool in RPT , it wasn’t easy at first on how to manipulate data pool. It became trickily more difficult to handle when the data files grew for larger tests. Below are few of the tricks that helped me to overcome the clumsiness I had with datapool.

Tuesday, April 30

Running Rational Performance tester with agents on other side of firewall

Rational Performance tester in terms of software installations as three components
1. RPT master or workbench
2. RPT License server
3. RPT Agents
RPT master is similar to controller in Loadrunner and plays central role in configuring and executing tests. In a case, where you got RPT agents inside the firewall and master outside or vice versa, the ports with which this communication generally happens becomes key as these ports need to be opened to make the test execution possible.  Also if license server is on other side of firewall with respect to workbench , it also requires to open appropriate firewalls.

Monday, April 29

How to setup Multiple RPT agents on high end server

Rational Performance tester agents are driver process built on Java. Rpt agent doesn't scale up directly even though you throw more hardware in terms of memory/cpu on it. The reason being the memory constraint for Java heap size of the driver process on agent machine. The maximum heap size for RPT_VMARGS property on linux OS is 3000m. So if you have a big iron having multiple cores and high memory as much as 32GB, then running one agent handicaps you from using the real power of the machine and all the memory goes wasted. To overcome this, there is way you run many RPT agent drivers  that can help to use the power of the high end server and drive more user load during the test.

Friday, April 26

Memory considerations In Rational Performance tester (RPT)

Rational Performance tester tool is built on Java/Eclipse technology. Unlike Loadrunner, there are few memory implications that one has to be aware when using Rational performance tester.
RPT is GUI based tool and main GUI is enhanced eclipse. This is called workbench and mirrors controller in Loadrunner. The memory settings of the eclipse is key in having responsive workbench.
Other region of interest with regards to RPT memory is the driver memory . This memory is very key is executing higher number of users otherwise, you will face the issue of Java Out of memory very frequently. As evidently this two setting both relate to  JVM memory settings.

How to create new Rational Performance tester Custom report?

Rational Performance tester (RPT) has good feature to create custom reports. The main thing with default reports was the challenge to filter the report for each individual test scripts and have these are readily available in RPT.
Workaround is to create your own reports that you can fetch whenever required with just couple clicks.
Below are the steps that can help to create the your own Rational performance tester custom report.
1. Creating new report template
2. Creating the tabs as many as you want that have the charts,table or graphic the way you want
3. Adding graphic filters – like top 10 page hits etc
4. Adding the performance counters that you want the report to present like average page response time, or total completed transactions etc

Sunday, April 15

RPT : Extracting value based on the occurrence that is passed dynamically

Rational Performance tester does correlation by extracting dynamic values in response by creating a reference. But it lacks ability for an user to specify if the occurrence dynamically that needs to extracted .
For ex: Say in an application, after user logins , he views displayed list of cards. He picks first card which is default and picks any other card alternatively sometimes. You got a task cut out to create a script which picks 60 percent default card and other 40 percent of time any of the alternate cards. You cannot select 'Random Occurrence ' option because it defeats purpose of simulating default card 60 % of time or vice verse.

So to overcome the limitation in RPT, one has to find a way to pass the occurrence you want to pick and pick the card by that occurrence value(not just random occurrence). Here in this blog I would focus on extracting that  value based on dynamic occurrence which is passed to a custom code interface . For this below are steps that need to be done

What does RPT Lacks for a Loadrunner User


    I have been a HP Loadrunner user most of the time for Performance/Load Test.  Off late, I ventured into task  to use IBM Rational Performance tester (RPT). I did had very pleasant surprises from this tool . Below are few of those to mention
  1. Automatic correlation feature got me quite amazed when it worked flawless all the time. RPT Uses Perl type of regular expression patterns to extract data from respone.  I was impressed with perl regular expression back in time when I first used Jmeter and still find they give robust way of defining pattern. RPT does all related to automatic extraction expression pattern, instance number etc. Thus makes life easy when creating a new script.
  2. Not just records thinktime, also records client processing delays . Hence represents right way of simulating secondary requests

  3. But I find that many features ,which are very common to Loadrunner or any scripting tool, are missing here in RPT. RPT does make maintaining scripts bit harder without simple scripting interface . Below are the few of those missing features that made RPT annoying to me at times.

Rational Performance tester(RPT) custom code to log user value fom datapool


Below is the custom code in Rational Performance tester that I managed for logging username value from datapool into test log. In Loadrunner, very often one uses commands like lr_message,lr_log_message to log username that was used by a particular virtual user in particular iteration. This helps performance tester to check whether the data was used was appropriate one, of if error occured, then what was the data used by the users etc. This this can be achieved in RPT by writing custom java code.
Custom  Code class implements interface ICustomCode which has method called exec with method parameters of object type ITestExecutionServices and type String array
The trick is understand the classes/method/interfaces of this Interface ITestExecutionServices. This object has information about a virtual user in interface name IDataArea . Below is the syntax to retrieve this Virtual user dataarea.

---------------------------------------------

Related Posts Plugin for WordPress, Blogger...