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


Saturday, March 15, 2014

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", "=",
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",

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

No comments:

Post a Comment