Wednesday, February 18, 2009

Content check for Web_service_call's response XML in Loadrunner

You never know what you gonna get if you do not have a content check for your response data.
If only it is a non-manual test---automation test, UI based performance test or web service call performance test and something else, you need to do validation for each response data!

A simple example for your reference, hope you can have a better solution to check the response data:

Note: in following web_service_call request, i have changed "<" into "{" and ">" into "}" due to some display issue by this blog:

web_service_call( "StepName=get****ByID_101",
"SOAPMethod=******",
"ResponseParam=response_1",
"Service=VendorServiceService",
"Snapshot=t1234933987.inf",
BEGIN_ARGUMENTS,
"xml:arg0="
"{arg0}"
"{externalID}2{/externalID}"
"{uniqueID}{/uniqueID}"
"{/arg0}",
END_ARGUMENTS,
BEGIN_RESULT,
END_RESULT,
LAST);

find_cnt =lr_xml_find("XML={response_1}",
"Query=//meetingRoomSetups[2]/name",
"Value=banquet",
"IgnoreCase=Yes",
"NotFound=error",
LAST);

if (find_cnt ==0) {
lr_out_message(...);
lr_exit(...);
}

So you can simply use lr_xml_find()to check the critical or unique value in the response XML,just like web_reg_find() to do content check for Web requests.

of Course you can use Checkpoint for content check, it is easy to fill in the expect result in Checkpoint tab from tree view in Vugen

No comments:

Post a Comment