Exception when run load test use visual studio.

  Sometimes you can single run the performance test pass, but when add them to load test and run, will get exception, this topic will list some exception and give the solution.

 

1. Extraction Rule  ExtractHiddenFields  No hidden fields were found in the response. 

This because some times the hiden filed that request1 returned response will lost, can change another way to extract the field and used it in request2, anyway you  need to make sure there's no extract rule in your code, and also some times you don't need to dynamic read the response, just debug and hard code some  this.Context value for some parameter that value won't change when you every run, likethis.Context["QueryStringParam8.wctx"].ToString(), the extract rule actually will get part of the request1's reponse content string, it's always the same everytime run.

 

privatevoid request1_PostRequest(object sender, PostRequestEventArgs e)

{

e.WebTest.Context["$HIDDEN1.__VIEWSTATE"] = "";

e.WebTest.Context["$HIDDEN1.__EVENTVALIDATION"] = "";

e.WebTest.Context["$HIDDEN1.__db"] = "";

if (e.ResponseExists)

{

e.WebTest.Context["nextRequestEncoding"] = e.Response.CharacterSet;

foreach (HtmlTag input in e.Response.HtmlDocument.GetFilteredHtmlTags("input"))

{

e.WebTest.Context["$HIDDEN1." + input.GetAttributeValueAsString("name")] = input.GetAttributeValueAsString("value");

}

}

else

 

{

thrownewException(string.Format("The requested url {0} does not response!", e.Request.Url));

}

}


WebTestRequest request1 = newWebTestRequest((this.Context["WebServer1"].ToString() + "/main.aspx"));

request1.ExpectedResponseUrl = @"https://adfs.cattest.redmond.corp.microsoft.com/adfs/ls/?wa=wsignin1.0&wtrealm=https%3a%2f%2ftest004.cattest.redmond.corp.microsoft.com%3a5443%2f&wctx=rm%3d1%26id%3d7dc2e961-d9ad-44e3-81a9-781510fd2e39%26ru%3dhttps%253a%252f%252ftest004.cattest.redmond.corp.microsoft.com%253a5443%252fmain.aspx&wct=2013-07-30T05%3a12%3a00Z&wauth=urn%3aoasis%3anames%3atc%3aSAML%3a1.0%3aam%3apassword";

//ExtractHiddenFields extractionRule1 = new ExtractHiddenFields();

 

//extractionRule1.Required = true;

 

//extractionRule1.HtmlDecode = true;

 

//extractionRule1.ContextParameterName = "1";

 

//request1.ExtractValues += new EventHandler<ExtractionEventArgs>(extractionRule1.Extract);

request1.PostRequest += newEventHandler<PostRequestEventArgs>(request1_PostRequest);

 

ExtractText extractionRule2 = newExtractText();

extractionRule2.StartsWith = "&amp;wctx=";

extractionRule2.EndsWith = "&";

extractionRule2.Index = 0;

extractionRule2.IgnoreCase = false;

extractionRule2.UseRegularExpression = false;

extractionRule2.HtmlDecode = true;

extractionRule2.Required = false;

extractionRule2.ContextParameterName = "QueryStringParam8.wctx";

request1.ExtractValues += newEventHandler<ExtractionEventArgs>(extractionRule2.Extract);

ExtractText extractionRule3 = newExtractText();

extractionRule3.StartsWith = "&amp;wct=";

extractionRule3.EndsWith = "&";

extractionRule3.Index = 0;

extractionRule3.IgnoreCase = false;

extractionRule3.UseRegularExpression = false;

extractionRule3.HtmlDecode = true;

extractionRule3.Required = false;

extractionRule3.ContextParameterName = "QueryStringParam9.wct";

request1.ExtractValues += newEventHandler<ExtractionEventArgs>(extractionRule3.Extract);

yieldreturn request1;

request1 = null;

 

 

WebTestRequest request2 = newWebTestRequest((this.Context["WebServer2"].ToString() + "/adfs/ls/"));

request2.Method = "POST";

request2.Headers.Add(newWebTestRequestHeader("Referer", (this.Context["WebServer2"].ToString()

+ ("/adfs/ls/?wa=wsignin1.0&wtrealm="

 

+ (this.Context["WebServer3"].ToString() + "%2f&wctx=rm%3d1%26id%3d7dc2e961-d9ad-44e3-81a9-781510fd2e39%26ru%3dhttps%253a%252" +

"f%252ftest004.cattest.redmond.corp.microsoft.com%253a5443%252fmain.aspx&wct=2013" +

"-07-30T05%3a12%3a00Z&wauth=urn%3aoasis%3anames%3atc%3aSAML%3a1.0%3aam%3apassword" +

"")))));

request2.QueryStringParameters.Add("wa","wsignin1.0",false,false);

request2.QueryStringParameters.Add("wtrealm", (this.Context["WebServer3"].ToString() + "%2f"),false,false);

request2.QueryStringParameters.Add("wctx",this.Context["QueryStringParam8.wctx"].ToString(),false,false);

request2.QueryStringParameters.Add("wct",this.Context["QueryStringParam9.wct"].ToString(),false,false);

request2.QueryStringParameters.Add("wauth","urn%3aoasis%3anames%3atc%3aSAML%3a1.0%3aam%3apassword",false,false);

FormPostHttpBody request2Body = newFormPostHttpBody();

request2Body.FormPostParameters.Add("__VIEWSTATE",this.Context["$HIDDEN1.__VIEWSTATE"].ToString());

request2Body.FormPostParameters.Add("__EVENTVALIDATION",this.Context["$HIDDEN1.__EVENTVALIDATION"].ToString());

request2Body.FormPostParameters.Add("__db",this.Context["$HIDDEN1.__db"].ToString());

request2Body.FormPostParameters.Add("ctl00$ContentPlaceHolder1$PassiveIdentityProvidersDropDownList","");

request2Body.FormPostParameters.Add("ctl00$ContentPlaceHolder1$PassiveSignInButton","Continue to Sign In");

 

2.

fffaultstring > Microsoft.Crm.CrmException: INVALID_WRPC_TOKEN: Validate WRPC Token: WRPCTokenState=Invalid, TOKEN_EXPIRY=4320, IGNORE_TOKEN=False, TOKEN_KEY=aoKRQfjUEeKYSDxKkuEPMhFIUwoBdTv/zf9ENFPrhU6oepFBffE3ASKqfHsbhHOk at Microsoft.Crm.Application.Security.WrpcContext.ValidateTokenState() at Microsoft.Crm.Application.Security.WrpcContext.ValidateToken() at Microsoft.Crm.Application.WebServices.AppWebService..ctor(Boolean wrpcCheck) ---> INVALID_WRPC_TOKEN: Validate WRPC Token: WRPCTokenState=Invalid, TOKEN_EXPIRY=4320, IGNORE_TOKEN=False, TOKEN_KEY=aoKRQfjUEeKYSDxKkuEPMhFIUwoBdTv/zf9ENFPrhU6oepFBffE3ASKqfHsbhHOk </ faultstring >
< faultactor > https://perf02.catperf.microsoft.com:5443/AppWebServices/CustomerService.asmx </ faultactor >
 


request33.Headers.Add(newWebTestRequestHeader("CRMWRPCToken", token));

request33.Headers.Add(newWebTestRequestHeader("CRMWRPCTokenTimeStamp", timeStamp));
 
This becuause you didn't input the right token when call the service. currently, 1 walk around is use fiddler to catch the request and hard code the token and timeStamp, but the token will change, if you change another machine to run test code or time out of 24 hour,


Another walk around:

http://rajeevpentyala.wordpress.com/tag/tocken-check/

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值