Exception when run load test use visual studio.
来源:互联网 发布:csol三米优化刀 编辑:程序博客网 时间:2024/04/30 01:47
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 = "&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 = "&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.
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/
- Exception when run load test use visual studio.
- Open question when load testing web site use Visual studio.
- How to Use the Visual Studio .NET Application Center Test
- Result analysis on Loading test use visual studio.
- 四、Load test your app(Visual Studio Online负载测试)
- Hand to hand teach you load testing web site use Visual studio.
- Visual Studio Team Test 2010 Load Agent支持 64 位测试运行了 !
- 转载: Visual Studio Unit Test
- Unit Test in Visual Studio
- Why / When / How should I use exception in Python ?
- Use Python to run REST API Automation Test
- Use Immediate Window in Visual Studio
- Use Command Window in Visual Studio
- Load testing with Visual Studio Ultimate
- 使用 Visual Studio Team Test 进行单元测试
- Visual Studio 下的Test Framework (TBD)
- Visual Studio Team System - Unit Test
- 利用zend studio 9 run as PHPUnit Test总结
- Android 使用多个Intent 进行activity跳转 而没有finish的情况,如何直接退出系统
- PAT_1041: Be Unique
- common-io之Comparator阅读
- javascript检查表单数据是否改变
- PKU 2886 反素数+线段树
- Exception when run load test use visual studio.
- PHP中set_time_limit
- 智慧可以求生
- 挂起一个进程
- sqlserver是用触发器来实现 insert 后 返回自增 行的id号
- VS2008学习
- POJ-2985-The k-th Largest Group
- UML中的泛化,关联,依赖
- maven自定义db2的jar包