There was an error in this gadget

Technical Project Lead @ Huawei Technologies

My photo
Bangalore/Hyderabad, Karnataka/Andhra Pradesh, India
Have an overall 10 + yrs of experience Currently working as an Senior Architect.Expertise in design,implementation of Automation frameworks for Opensource automation tools like Selenium,Jmeter, Webdriver,Appium, Robotium Expertise in integrating Test & ALM Management tools like Rally,Qmetry,JIRA-Zephyr with Automation frameworks Expertise in design and developmenet Mobile Automation frameworks for tools like Appium, Robotium Remote Control,Cucumber BDD

Followers

Sunday, August 10, 2014

JIRA Zephyr Introduction

JIRA is a well known Powerful project management tool for creation and maintain project taks.
Zephyer is one of the JIRA Plugins for Test Case Management where one can create,update,execute tests manually.
ZAPI is an interface that provides RESTful services that can be called from your code to create,update and execute tests. Zephyr does not comes default with JIRA license. You need to purchase separate license to get Zephyr installed. Having this you can create your tests manually. To have your test cases get created programatically you need to purchase additional licese for ZAPI in addition to Zephyr.

In my subsequent posts I would be posting topics on

  • JIRA Rest Interface
  • ZAPI Rest Interface
  • Fetching JIRA Projects
  • Fetching JIRA test cycles
  • Creating a Test Case
  • Creating Test Steps
  • Updating Test case
  • Assigning Test Case for Execution
  • Execution of Test Cases
  • Setting Execution statuses  (PASS/FAIL,WIP)


Webdriver Jmeter Integration Approach

There are couple of ways one can Integrate Webdriver scripts with Jmeter

1. Junit Sampler
2.Web driver Sampler

More to come on the above ones

Jmeter Introdcution

I have spend some time on analyzing functional automation using open source automation tools. This time I'm looking curious to explore some open source performance tools like Jmeter.

At the time when I was a fresher , I had some learning on Jmeter on performance testing  of web application and did some analysis on measuring performance for database like Postgre and Oracle.It was just couple of months and never looked back at Jmeter

In this blog i'm putting on the analysis and outcome of my understanding on Integrating Jmeter with Selenium webdriver in the recent times.

The intention of  writing this blog is to provide some context on how the Selenium based tests can be reused to measure some performance parameters if a webpage for a single user/multiple users. It is suggested that it not a good practice to drive your Webdriver-Jmeter tests with multiple sets of Threads as Jmeter spawns multiple threads for simulating multiple user simulation. Multiple threads opens multiple browsers and that kills your system memory. How ever if you have a high end configuration machine , yes you can create multiple threads

If you want more information on Jmeter check this http://jmeter.apache.org/

In my subsequent blogs I discuss the approach

- Integrating Webdriver with Jmeter
- Distribution of Webdriver Jmeter tests
- Invoking Webdriver Jmeter tests from Apache Ant 
- Generation of HTML reports

Saturday, March 15, 2014

How to Fetch the Rally User Story List

public Map<String, Map<String, String>> getFolderList() throws IOException {
if (folderReferenceMap.isEmpty()) {
QueryRequest folderRequest = new QueryRequest("TestFolder");
// spaces
folderRequest.setFetch(new Fetch("FormattedID", "Name"));
LOGGER.info("Feting the folder list from Rally for project ["
+ ReadProperties.getInstance().getProperty("rallyProject")
+ "]");
folderRequest.setQueryFilter(new QueryFilter("Project.Name", "=",
ReadProperties.getInstance().getProperty("rallyProject")));
QueryResponse folderQueryResponse = restApi.query(folderRequest);
// JsonObject testSetJsonObject =
// testSetQueryResponse.getResults().get(0).getAsJsonObject();
JsonArray resultArray = folderQueryResponse.getResults();
for (JsonElement result : resultArray) {
String rallyFolderObjId = result.getAsJsonObject().get("_ref")
.getAsString();
LOGGER.debug(rallyFolderObjId);
String rallyFolderName = result.getAsJsonObject()
.get("_refObjectName").getAsString();
// System.out.println(rallyFolderName);

String formattedId = result.getAsJsonObject()
.get("FormattedID").getAsString();
// System.out.println(formattedId);

String testFolder = "testfolder";
int stringPosition = rallyFolderObjId.indexOf(testFolder)
+ testFolder.length() + 1;
rallyFolderObjId = rallyFolderObjId.substring(stringPosition,
rallyFolderObjId.length());
// System.out.println(rallyFolderObjId);
Map<String, String> folderMap = new HashMap<String, String>();
folderMap.put(rallyFolderObjId, rallyFolderName);
folderReferenceMap.put(formattedId, folderMap);

}
LOGGER.debug("Folder list loading  from Rally is complete");
}

return folderReferenceMap;

}

How to fetch the Rally Folder List

public Map<String, Map<String, String>> getFolderList() throws IOException {
if (folderReferenceMap.isEmpty()) {
QueryRequest folderRequest = new QueryRequest("TestFolder");
// spaces
folderRequest.setFetch(new Fetch("FormattedID", "Name"));
LOGGER.info("Feting the folder list from Rally for project ["
+ ReadProperties.getInstance().getProperty("rallyProject")
+ "]");
folderRequest.setQueryFilter(new QueryFilter("Project.Name", "=",
ReadProperties.getInstance().getProperty("rallyProject")));
QueryResponse folderQueryResponse = restApi.query(folderRequest);
// JsonObject testSetJsonObject =
// testSetQueryResponse.getResults().get(0).getAsJsonObject();
JsonArray resultArray = folderQueryResponse.getResults();
for (JsonElement result : resultArray) {
String rallyFolderObjId = result.getAsJsonObject().get("_ref")
.getAsString();
LOGGER.debug(rallyFolderObjId);
String rallyFolderName = result.getAsJsonObject()
.get("_refObjectName").getAsString();
// System.out.println(rallyFolderName);

String formattedId = result.getAsJsonObject()
.get("FormattedID").getAsString();
// System.out.println(formattedId);

String testFolder = "testfolder";
int stringPosition = rallyFolderObjId.indexOf(testFolder)
+ testFolder.length() + 1;
rallyFolderObjId = rallyFolderObjId.substring(stringPosition,
rallyFolderObjId.length());
// System.out.println(rallyFolderObjId);
Map<String, String> folderMap = new HashMap<String, String>();
folderMap.put(rallyFolderObjId, rallyFolderName);
folderReferenceMap.put(formattedId, folderMap);
xAFTRallyScenarioDataMap.getInstance().setFolderReferenceMap(
folderReferenceMap);
}
LOGGER.debug("Folder list loading  from Rally is complete");
}

return folderReferenceMap;

}

How to get the List of all Test Cases

//Below Code fetches the list of TestCases based on Filter (Project,Folder,Owner..)

public List<String> getTestCaseDetails(RallyRestApi restApi,
String methodName, String folder, String projectName)
throws IOException {
// All Test cases
QueryRequest testcases = new QueryRequest("Test Case");
testcases.setFetch(new Fetch("FormattedID", "Name", "Owner",
"Test Folder"));
testcases.setQueryFilter(new QueryFilter("Project.Name", "=",
projectName).and(
new QueryFilter("TestFolder.Name", "=", folder)).and(
new QueryFilter("Method", "=", methodName)));
testcases.setOrder("FormattedID ASC");
QueryResponse queryResponse = restApi.query(testcases);
JsonArray testCaseList = new JsonArray();
if (queryResponse.wasSuccessful()) {
System.out.println(String.format("\nTotal results: %d",
queryResponse.getTotalResultCount()));

testCaseList = queryResponse.getResults().getAsJsonArray();
for (JsonElement testCase : testCaseList) {
JsonObject json = new JsonObject();
json = testCase.getAsJsonObject();
System.out.println(json.get("FormattedID"));
System.out.println(json.get("LastVerdict"));
System.out.println(testCase);
testCaseInfoList.add(testCase.toString());
}
} else {
for (String err : queryResponse.getErrors()) {
System.err.println("\t" + err);
}
}
return testCaseInfoList;
}

How to get list of Rally Projects

public Map<String, List<String>> getProjectReferenceMap()
throws IOException {
// Get the workspace references
List<String> workspaceReferenceList = getWorkSpaceReferences();
String workSpaceName = "";
String projectRef = "";
GetRequest workspaceRequest;
GetResponse workspaceResponse;
Map<String, List<String>> projectWorkSpaceMap = new HashMap<String, List<String>>();
List<String> projectList = new ArrayList<String>();
// Iterate through each workspace and get all the project associated
// with each workspace
for (String workspaceRef : workspaceReferenceList) {
// Get the workspaces
if (workspaceRef.equalsIgnoreCase("workSpace")) {
workspaceRequest = new GetRequest(workspaceRef);
workspaceRequest.setFetch(new Fetch("Name", "Projects"));
workspaceResponse = restApi.get(workspaceRequest);
JsonObject workspaceObj = workspaceResponse.getObject();
JsonArray workspaceArray = workspaceObj.get("Results")
.getAsJsonArray();
JsonObject jo;
JsonElement projRef;
// For each workspace get the list of projects
for (int i = 0; i < workspaceArray.size(); i++) {
jo = workspaceArray.get(i).getAsJsonObject();
workSpaceName = jo.get("Name").getAsString();
projRef = jo.get("Projects");
JsonObject jobject = projRef.getAsJsonObject();
JsonElement je = jobject.get("_ref");
projectRef = je.toString();
projectList.add(projectRef);
}
projectWorkSpaceMap.put(workSpaceName, projectList);
}

}

return projectWorkSpaceMap;
}