InfoStretch Test Automation Framework

InfoStretch Test Automation Framework

I want to take opportunity to introduce you InfoStretch test automation framework. With increase in market needs for creating efficient web functional test automation using selenium, InfoStretch has developed an automation framework. InfoStretch test automation framework is designed to solve common industry problems related to testing complex web systems. The framework is best suited for writing Automated Web Application UI Tests to simulate real user activities on the page.

The framework is built upon java and integrates TestNG, Selenium, Autoit, ReportNG. Due to the framework’s thorough design, test developer does not need to worry about common tasks such as thread safe browser session for running test in parallel, reporting or to incorporate result with test management tools. The tests run can be configured through standard testing configuration files, the test run filters and behavior can be changed within the config File.

The architecture of the framework ensures a low cost of maintenance while supporting extensibility by:

  • Abstracting the technical implementation away from the operational components
  • Following accepted design patterns in creating the core functionalities within the framework.
  • Providing an approach to develop highly maintainable and repeatable tests that utilize reusable test assets, proper modularity and semantic structure. Framework has readymade services for assertions, browser, reporting and data. Also, framework concept is based on page services so your page and related actions will be reusable from any test case. There is a good logging functionality and screen shot facility for assertions.

Features

Some features of the framework are:

  • Less maintenance
  • More reusability of code
  • Reduced execution time
  • Data-driven capability
  • Handles file upload/download
  • Easy configurable parallel execution, Supports parallel execution provided by TestNG
  • Descriptive report with all verification/assertions having screenshots
  • Utility classes
  • Test Results integration with test management tools like QMetry, Rally.
  • Integration with Sauce labs, Supports parallel execution
  • Enabling testing across multiple platforms with or without selenium grid

Question over here is how the framework reduces maintenance, execution time and reuses code?

InfoStretch test automation framework provides high level construct to satisfy automation needs. It includes top level interfaces, abstract base classes, service classes and their implementations and custom annotations. Test developer only need to concentrate on writing the tests and not spend time on adjusting the underlying framework.

This framework provides test page concept in a best efficient way by which you can manipulate page navigation same as on actual web application under test. Once page get created page objects/functionalities can be used in any test case, makes code more reusable. The framework takes care of not only launching that page but the entire page hierarchy to reach that specific page. Furthermore it also checks that is page already active in browser? If so then it will continue from there, results in reduced execution time.

When functionality changes only the specific test page file needs to be updated: if there is any change in page/ui of web application under test you need to update just in particular page rather than each and every test case, thus result in less maintenance.

In case of sequential execution it will take advantage of sharing browser sessions between multiple test cases. No special coding or design required to run test in parallel, you just need to set parallel attribute’s appropriate value in configuration file (eg. false, Test, methods, classes) and framework will take care for providing thread safe browser sessions with maximum level of sharing browser session between multiple test cases.? This will result in reducing time by parallel processing as well as by some level of sharing browser session(depends on configuration). You also can configure to run parallel in different browser (eg. iexplorer, firefox) with or without selenium grid. If you are not planning for physical distributed selenium server then, without selenium grid, you can achieve higher performance by the framework as compare to grid that configured different selenium server instance on the same physical machine. While integration with Sauce labs, though Sauce labs not provides parallel processing, still you can achieve parallel processing using this framework.

Reporting of test run result includes selenium commands log, each assertions/verification details with screenshot on failure. One can configure to capture screenshots for pass verifications too.

Case Study:

For understanding how one can create page navigation let us see an example. Suppose I want to write test case(s) for edit user account functionality on my web site. In order to test it manually one has to navigate through login page-> My account -> edit account. The page implementation for this site looks like below:

 

/**

* Login page ? site entry point

* Reacts as home page once user logged in

*/

publicclass LoginPage extends BaseTestPage<TestPage> {

public LoginPage (SeleneseTestBase stb) {

super(stb);

}

??

}

publicclass MyAccountPage extends BaseTestPage<LoginPage> {

public MyAccountPage (SeleneseTestBase stb) {

super(stb);

}

??

}

publicclass EditAccountPage extends BaseTestPage<MyAccountPage> {

public EditAccountPage (SeleneseTestBase stb) {

super(stb);

}

// below are method that will be used by framework as and when needed

@Override

protectedvoid initParent() {

parent = new MyAccountPage(stb);

}

@Override

protectedvoid openPage(PageLocator loc) {

parent.clickEditAccount();

//selenium.click(loc.getLocator());

}

@Override

publicboolean isPageActive() {}

??

}

//page functionality goes here

//for all elements

publicvoid editAccountDetais(UserInfoBean bean) {

//set element values

}

//for individual element

publicvoid setFirstName(String s) {

}

publicvoid save() {

}

??

}

Now to create a testcase for use account edit functionaly, you need to do as below:

@Test

publicvoid TC01() {

EditAccountPage editAccount = new EditAccountPage(getSTB());

editAccount.launchPage(editAccountLoc);

editAccount.setFirstName(??fname test??);

editAccount.save();

}

Framework Architecture:

Tools integration:

 

Infostretch Test Automation Framework

I want to take opportunity to introduce you Infostretch test automation framework. With increase in market needs for creating efficient web functional test automation using selenium, Infostretch has developed an automation framework. Infostretch test automation framework is designed to solve common industry problems related to testing complex web systems. The framework is best suited for writing Automated Web Application UI Tests simulate real user activities on the page.

The framework is built upon java and integrates TestNG, Selenium, Autoit, ReportNG. Due to the framework’s thorough design, test developer does not need to worry about common tasks such as thread safe browser session for running test in parallel, reporting or to incorporate result with test management tools. The tests run can be configured through standard testing configuration files, the test run filters and behavior can be changed within the config File.

The architecture of the framework ensures a low cost of maintenance while supporting extensibility by:

  • Abstracting the technical implementation away from the operational components
  • Following accepted design patterns in creating the core functionalities within the framework.
  • Providing an approach to develop highly maintainable and repeatable tests that utilize reusable test assets, proper modularity and semantic structure. Framework has readymade services for assertions, browser, reporting and data. Also, framework concept is based on page services so your page and related actions will be reusable from any test case. There is a good logging functionality and screen shot facility for assertions.

Features

Some features of the framework are:

?Less maintenance

?More reusability of code

?Reduced execution time

?Data-driven capability

?Handles file upload/download

?Easy configurable parallel execution, Supports parallel execution provided by TestNG

?Descriptive report with all verification/assertions having screenshots

?Utility classes

?Test Results integration with test management tools like QMetry, Rally.

?Integration with Sauce labs, Supports parallel execution

?Enabling testing across multiple platforms with or without selenium grid

Question over here is how the framework reduces maintenance, execution time and reuses code?

Infostretch test automation framework provides high level construct to satisfy automation needs. It includes top level interfaces, abstract base classes, service classes and their implementations and custom annotations. Test developer only need to concentrate on writing the tests and not spend time on adjusting the underlying framework.

This framework provides test page concept in a best efficient way by which you can manipulate page navigation same as on actual web application under test. Once page get created page objects/functionalities can be used in any test case, makes code more reusable. The framework takes care of not only launching that page but the entire page hierarchy to reach that specific page. Furthermore it also checks that is page already active in browser? If so then it will continue from there, results in reduced execution time.

When functionality changes only the specific test page file needs to be updated: if there is any change in page/ui of web application under test you need to update just in particular page rather than each and every test case, thus result in less maintenance.

In case of sequential execution it will take advantage of sharing browser sessions between multiple test cases. No special coding or design required to run test in parallel, you just need to set parallel attribute??s appropriate value in configuration file (eg. false, Test, methods, classes) and framework will take care for providing thread safe browser sessions with maximum level of sharing browser session between multiple test cases.This will result in reducing time by parallel processing as well as by some level of sharing browser session(depends on configuration). You also can configure to run parallel in different browser (eg. iexplorer, firefox) with or without selenium grid. If you are not planning for physical distributed selenium server then, without selenium grid, you can achieve higher performance by the framework as compare to grid that configured different selenium server instance on the same physical machine. While integration with Sauce labs, though Sauce labs not provides parallel processing, still you can achieve parallel processing using this framework.

Reporting of test run result includes selenium commands log, each assertions/verification details with screenshot on failure. One can configure to capture screenshots for pass verifications too.

Sample Code:

For understanding how one can create page navigation let us see an example. Suppose I want to write test case(s) for edit user account functionality on my web site. In order to test it manually one has to navigate through login page-> My account -> edit account. The page implementation for this site looks like below:

/**

* Login page ? site entry point

* Reacts as home page once user logged in

*/

publicclass LoginPage extends BaseTestPage<TestPage> {

public LoginPage (SeleneseTestBase stb) {

super(stb);

}

??

}

publicclass MyAccountPage extends BaseTestPage<LoginPage> {

public MyAccountPage (SeleneseTestBase stb) {

super(stb);

}

??

}

publicclass EditAccountPage extends BaseTestPage<MyAccountPage> {

public EditAccountPage (SeleneseTestBase stb) {

super(stb);

}

@Override

protectedvoid initParent() {

parent = new MyAccountPage(stb);

}

@Override

protectedvoid openPage(PageLocator loc) {

parent.clickEditAccount();

//selenium.click(loc.getLocator());

}

@Override

publicboolean isPageActive() {

}

//page functionality goes here

//for all elements

publicvoid editAccountDetais(UserInfoBean bean) {

//set element values

}

//for individual element

publicvoid setFirstName(String s) {

}

publicvoid save() {

}

??

}

Now to create a testcase for use account edit functionaly, you need to do as below:

@Test

publicvoid TC01() {

EditAccountPage editAccount = new EditAccountPage(getSTB());

editAccount.launchPage(editAccountLoc);

editAccount.setFirstName(??fname test??);

editAccount.save();

}

Framework Architecture:

Tools integration:

VN:D [1.9.10_1130]
Rating: 9.4/10 (29 votes cast)
InfoStretch Test Automation Framework, 9.4 out of 10 based on 29 ratings

  

{ 3 trackbacks }

Selenium IDE Plug-in for InfoStretch Framework
August 3, 2011 at 7:30 am
Mobile Web Application Test Automation – IV
November 4, 2011 at 9:58 am
Running test on cloud with InfoStretch Test Automation Framework
November 4, 2011 at 10:00 am

{ 24 comments… read them below or add one }

Tarun k March 8, 2011 at 10:44 pm

You might consider using page object to distinguish between test methos and UI interaction code.

chirag.jayswal March 16, 2011 at 8:04 am

HI Tarun,
The framework has some extensive capabilities with/without use of webdriver. Some features listed above including data-driven and parallel execution without any extra efforts. You can check http://blog.infostretch.com/?p=973 for getting more information on how page hierarchy will work efficiently.

You need to write code using regular selenium api that is easy to learn. The FW support selenium conventional way as well as selenium 2 webdriver. You need to set appropriate browser string in application properties. For instance, Following are different browser configurations for Firefox:

  • *firefox – required selenium server running on configured host/port if not found then fw will check/start one on locahost/port
  • firefoxDriver – will run directly with firefox web driver without selenium server
  • firefoxRemoteDriver – required selenium server running on configured host/port if not found then fw will check/start one on locahost/port, it will run test using firefox web driver on host machine

Same way for IE – *iexplore, *iehta, iexplorerDriver, iexplorerRemoteDriver and so on.
One can also utilize grid or sauce cloud service without change in automation code.
Thanks,
Chirag

Gaurav August 3, 2011 at 12:41 am

Could you please share how we can achieve following:

“Furthermore it also checks that is page already active in browser? If so then it will continue from there, results in reduced execution time.”

Thanks in advance..

Regards,
Gaurav

Chirag Jayswal August 3, 2011 at 10:54 am

Hi Gaurav,
It will taken care by the framework. If you see the sample code above you may found launchPage method that is provided by BaseTestPage. So in test you just need to launch the page without taking care about is there browser open or is there a page open or how efficiently we can reduce the step at run time with different test configuration. I think this will answer to your question. Please feel free sending your queries.

Thanks,
Chirag

Ravi August 19, 2011 at 3:31 am

Hi Chirag,
Thanks for sharing the jar, i have a question regarding the page navigation you explained above.
In your example in the case study you have some thing like, page-> My account -> edit account. But, say suppose there is more than one way to reach the “edit account” page, how can we handle this?

Thanks,
Ravi

Chirag Jayswal August 19, 2011 at 6:48 am

Hi Ravi,
Good question!
The framework has multiple route support. In case of multiple route, to navigate to specific page you need to define launcher interface that extends TestPage and provide that interface as parent to the page with multiple route.Implement launcher interface in each possible parent class. At the time of defining test provide parent as argument while creating page object.
Here is the example for better understanding:

interface MultiRoutePageLauncher extends TestPage {
public void launchMultiRoutePage(PageLocator loc);
}
public class MultiRoutePage extends BaseTestPage {

public MultiRoutePage(MultiRoutePageLauncher parent) {
super(parent);
}
public MultiRoutePage() {
// either provide default route in initParent
//or remove this constructor
}
@Override
protected void initParent() {
// set default route or do nothing
parent = new Route1Page();
}

@Override
protected void openPage(PageLocator loc) {
parent.launchMultiRoutePage(loc);

}

}
public class Route1Page extends BaseTestPage implements MultiRoutePageLauncher {
@Override
public void launchMultiRoutePage(PageLocator loc) {
// steps to open page. For example:
selenium.click(“locator”);
}

}
public class Route2Page extends BaseTestPage implements MultiRoutePageLauncher {
@Override
public void launchMultiRoutePage(PageLocator loc) {
// steps to open page. For example:
selenium.click(“locator”);
}

}
Your test method will look like:
@Test
public void testMethod() {
// Default Route
MultiRoutePage multiRoutePage = new MultiRoutePage();
// route 1
// MultiRoutePage multiRoutePage = new MultiRoutePage(new Route1Page());
// route 2
//MultiRoutePage multiRoutePage = new MultiRoutePage(new Route2Page());
MultiRoutePage.launchPage(pageLocator);

}

Thanks,
Chirag

Ravi August 19, 2011 at 5:04 pm

Hi Chirag,
Great thanks a lot, that looks good. Now, here are my other questions:
What is the actual intent of PageLocator? Is it meant to be used only with openPage() in the page object?

Also, how does the framework identify how a page is actually loaded?
Why i am asking this is because, now say suppose i have a page navigation from P1 -> P2, if i want to tell the framework that it has to wait for a specific list of elements to say that we are actually on P2, how can i do it in the current structure.

Thanks,
Ravi

Chirag Jayswal August 20, 2011 at 4:38 am

Hi Ravi,
Here are some details:
1. The page locator is intended for identifying exact locator when there are multiple locators available to open the page from the parent page. The ideal example is item details page which can be open from item list page. On item list page there can be list of items with available action for each item and each item’s “view details” action takes you to item details page. Here the page locator provides a way to locate specific item’s details page. For example open Item Details page for Item xxx. In other cases you can ignore it.
2. If you are going through page concept and launching the page by launch method then launch method take care about wait for page to load. When framework loads any page then it calls page specific waitForPageToLoad. The default implementation for waitForPageToLoad is provided by BaseTestPage. If you want to provide custom page specific implementation then you can achieve it by overriding waitForPageToLoad method in page class. For instance in your page class you can override waitForPageToLoad as below:
@Override
public void waitForPageToLoad() {
//super. waitForPageToLoad();
// waitForAjaxToComplete(JsToolkit.JQUERY);
//waitForElementPresent(“Loc”);
}
Hope now you will have better idea. The dominant characteristic of the framework is that, it supports different approach of implementation and provides a way to fulfill automation needs for different nature of AUT. You need to just utilize the features in your way.
Thanks,
Chirag

Ravi August 25, 2011 at 2:13 pm

Hi Chirag,
Thanks for the info, that makes things more clear :)
Here is one more question, and i am back to page navigation now :p
- Say suppose we are currently dealing with this page navigation:
P1 -> P2.
- But, to reach P2 say suppose there are two ways to it from P1
itself, how to handle these kind of situation.
Sorry for all these questions, i am trying to understand all the better ways to deal with these kind of things.

Thanks,
Ravi

Chirag Jayswal August 26, 2011 at 1:39 am

Hi Ravi,
It is the case that can be accomplished by use of page locator. In p2 you might have openPage implementation like:
@Override
protected void openPage(PageLocator loc) {
if (loc != null) {
parent. openItemDetails (loc.getLocator());

}
}
In p1
public void openItemDetails(String itemName) {
//create element locator for example
String eleLoc = “//div[@class='item' and contains(.,'" +
text + "')]//a”;
selenium.click(eleLoc);
}
Pass the page locator when launching P2. The simplest way is to use default implementation of page locator interface. However you might have page specific implementation for each page as per requirement.
P2 p2 = new P2();
p2. launchPage(new DefaultPageLocator(loc));

This is just to provide quick direction. You can provide efficient implementation by providing pageLocator implementation for page , overloading launchPage, and so on.

Chirag Jayswal August 26, 2011 at 1:43 am

in above example read
String eleLoc = “//div[@class='item' and contains(.,'" +
text + "')]//a”;

as

String eleLoc = “//div[@class='item' and contains(.,'" +
itemName + "')]//a”;

Hope you this will help you.
Thanks

Ravi August 27, 2011 at 2:17 pm

Hi Chirag,
Thanks a lot for the details, that gives me most of the details i am looking for when it comes to page navigations.
- In one of your examples above, you mentioned usage of
“JsToolkit.JQUERY”, can you share more info on JsToolKit?
- I am testing an application which is based on ExtJs, in my previous
project the application was based on YUI and i could use lot of built
in features provided by YUI to access the DOM.
- Can we also use existing javascript framework features like
JQuery/ExtJs to access the DOM.

Any pointers on this would help out a lot :)

Thanks,
Ravi

Chirag Jayswal August 28, 2011 at 12:56 am

You can wait for ajax request to complete if one of the following toolkit’s ajax functionality used. DOJO, EXTJS, JQUERY, YUI, PHPJS,PROTOTYPE.

ISFW provides Ext component and container support by generating dom query internally. Any ext component can be handed by use ExtComponent/ExtContainer. Here is sample code
ExtComponent combo = new ExtComponent(XTYPES.combo);
// simple way for setting value
combo.getEval(“setValue(‘Florida’)”);
Here setValue is ext function for combobox you can check ext doc for more help on ext component. Same way here is example for grid

ExtContainer grid = new ExtContainer(XTYPES.grid);
//alternate way
ExtGrid grid = new ExtGrid();
// will work for cell with combo box
grid.editCell(2, 1, “Sunny”);
// another way to select value form combo box
grid.selectCellValue(2, 1, 2);

You can execute extjs function available for specific ext component directly form Java code. For example:
price = grid.getEval(“getSelectionModel().getSelected().get(‘price’)”));

Hope this will helps!
Chirag

Ravi September 12, 2011 at 6:37 pm

Hi Chirag,
How can we use the existing framework to achieve “A/B Testing”?

Thanks,
Ravi

Chirag Jayswal September 13, 2011 at 7:52 am

Dear Ravi,
Are you talking about A/B testing marketing strategy? Will you please provide more details on use case?

Generally in A/B testing, single or multiple variable values measured from user response/interaction. So it requires actual user response/interactions to have the data for analysis. Selenium, and hence ISFW, is for web application functional test automation. If you have web interface and you are doing the task iteratively using web interface then there is scope of data driven automation that supported by ISFW where data are kept in database or data file (Excel sheet or CSV file) . Incidentally it will be the case of utilizing selenium/ISFW to achieve needs other then functional testing!
Thanks,
Chirag

Ravi September 13, 2011 at 2:51 pm

Hi Chirag,
Here is one use case i am looking at, and i am doing functional testing, already have automated tests up and running on an existing page.

Lets call the existing page as “AddAccountPage”.
Now, say suppose we are trying out a new version of the same page (“AddAccountPage1″). So now we have two versions of the same page “AddAccountPage” and “AddAccountPage1″.

Consider there are 3 fields on the existing page, the new page will have the same 3 fields but the layout has entirely changed, so does the DOM structure/attributes (ids, names etc).

Now, if run my existing tests against the new page, it will definitely break as we don’t have the required elements etc etc.

Considering that before running the tests, based on a config the tests will be notified on which version of page they are supposed to run on.

I don’t want my scripts to break, since in this scenario we are actually testing the same functionality :)

Thanks,
Ravi

Chirag Jayswal September 13, 2011 at 10:52 pm

In such case you can have locators in property file. If you are using ISFW then there are multiple ways to deal with such case. For simplicity you can have two separate properties file, let say version1.properties and version2.properties, place one of them into resources dir.

If you have more then one such page then you have separate dir for example stage1,stage2,test1,test2 etc. In application properties file you can provide dir from where properties get loaded by setting test.props.dir.

The second way, you can utilize page constructor with properties file arg provided by BaseTestPage.

I hope this will help you.

Rivlin October 23, 2011 at 11:33 am

Hi Chirag,

1) Can I use custom reporting framework like TestNG if i want drill down reports which TestNG provides. Is that possible if I use Infostretch Framework?
2) Can i integrate this with continuous Integration tools like Jenkins?
3) Can i write webdriver tests ?

Thanks,

Chirag Jayswal October 23, 2011 at 12:38 pm

HI Rivlin,
Here are answers to your questions:

  1. Yes you can utilize any of the feature provided by TestNG. You add appropriate testNG listener in configuration file under config dir or add in ant build file under scripts dir.
  2. Yes you can easily integrate with different continuous integration tools like Jenkins, Teamcity, Hudson
  3. Same test can run on Webdriver, you don’t required to write code specific to webdriver. To run your test using webdriver you just need to set appropriate browser string as described above for instance run your test using browser string firefoxDriver or firefoxRemoteDriver. Furthermore if you are planning only for webdriver and want to get webdriver instance then you can get as
    WebDriver driverInstance =
    ((ISWebDriverBackedSelenium) selenium).getWrappedDriver();
    .

Thanks,
Chirag

Srinivas May 24, 2012 at 1:50 am

Hi Chirag,

We have used ISFW and automated the log-in page of our web application using Selenium-WebDriver.
This runs on Eclipse env and open FireFoxWebDriver and login page of our application.

The same java file placed in /src/com/sample/automation/tests/test.java and tried running using ISFW but it didnot run.
But able to run the Demo.java provided as part of ISFW jar.

Can you please help/suggest me why test,java is not run using ISFW.

Code inside test.java is as follows:
==========================

package com.sample.automation.tests;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.WebDriverWait;

public class test{

public static void main(String[] args) {

WebDriver driver = new FirefoxDriver();
driver.get(“https:google.com”);

}
}

Can you please suggest me if any packages need to be declare d in test.java to run using ISFW framework

Ajay July 4, 2012 at 2:58 am

Hi Chirag,
I am using webdriver and my requirement is– take a screenshort of every page on each click and that to be save in folder with different name.
I have code and which running to take screenshort but its working to take last page screenshort of every test method.
So please guide me resolve this issues.
I am waiting for your early response.
Regards
Ajay

Chirag Jayswal July 11, 2012 at 5:20 pm

Hi Ajay,
For this requirement, if you are using ISFW then you can write webelement command listener provided by ISFW. Following class will capture screen shot after each click and will provide link in report.

package test;
import …

public class WECommandListener extends IsWebElementCommandAdapter {
@Override
public void afterCommand(IsExtendedWebElement element,
CommandTracker commandTracker) {
if (commandTracker.getCommand().equalsIgnoreCase(DriverCommand.CLICK)) {
SeleneseTestBase stb = ThreadLocalSeleniumBase.instance().get();
stb.addAssertionLog(stb.captureScreenShotAndGetLink(), MessageTypes.Info);
}
}
}
You need to register this listener by providing property “we.command.listeners”, for example,
we.command.listeners=test.WECommandListener

If you are not using ISFW then you can use WebDriverEventListener with EventFiringWebDriver and can provide implementation in
public void afterClickOn(WebElement element, WebDriver driver) {
// TODO Auto-generated method stub

}

Hope this will address to your question.

Thanks,
Chirag

Dinesh October 12, 2012 at 7:58 am

Hi,

I am working with selenium RC and WebDriver api using ISFW. But I am unable to use Selenium Grid in ISFW. Is ISFW support selenium Grid? If it supports how can i use selenium Grid in ISFW ?

Thanks.
Dinesh

Chirag Jayswal December 4, 2012 at 6:38 am

Hi Dinesh,
Please refer FAQ
Thanks,
Chirag

Leave a Comment