Monday, November 15, 2010

How to capture the Response in Web Performance test with C Sharp Code?

Use the “Extractvalues” method before “Yield return rquest1” statement in the generate .CS file and then define method with object and ExtractionEventArgs orguments like below .

Below statement add before the “Yield return rquest1” statement
Request1.ExtractValues +=new EventHandle (request1_ExtractValues);

Method definication :--

Void request1_ExtractValues(object sender,ExtractionEventArgs e)
{
// with below statement capture the response
var response=e.Response.BodyString;

// save the response with below code
XmlDocument doc=new XmlDocument();
doc.LoadXml( response);
// Get the value from required node
XmlNodeList var1=doc.GetElementsByTagName(“Node Name”)
// Get the nodes count
int NodeCount=var1.Count;
// for value capture code
Nodevalue=Var1[0].InnerText;

No comments:

Post a Comment