Monday, July 1, 2019

HTTP Error 411. The request must be chunked or have a content length in VSTS web test 2017

Problem: 
I recorded a web test and while playing back , one of my request is failing with error :
HTTP Error 411. The request must be chunked or have a content length.  when I try to replay this request with same data in fiddler or postman, request is returning status code 200. 
















Analysis
  • I verified headers  , query string parameters in the request but I don't see any difference. 
  • When i verify in App insights, I don't see this request in app insights. 
Solution : 
  • Create a new request 
    • right click on next request and click on insert new request . 
    • copy URL from failing request 
    • Copy query string parameters and headers from failed request. 
    • delete failed request . 
  • Execute web test .. request is successful with http status code - 200.  

Thursday, January 3, 2019

Request failed: Exception occurred: Could not load file or assembly


Problem: 
When we add any web test plug in or web request plug in we are getting  error “Request failed: Exception occurred: Could not load file or assembly '<<Solution name>>, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.” 

Solution : We have to add your .CS file or folder contains file in deployment directory. 
Solution items --> Local.test settings --> Deployment --> Enable deployment (check box) and then add file / directory --> Save test settings. 






Monday, June 1, 2015

How to remove dependent request of dependent request in VSTS web test

Issue:
I have a junk request as dependent of dependent request in my web test. I need to delete that junk request.
Solution:
If it is dependent request then deleting is pretty much easy but to delete dependent request of dependent request is little bit difficult.

Below code wettestrequest plug in will help you to do that task.

public class Removedepdep : WebTestRequestPlugin
    {
        string m_startsWith;
        public string FilterDependentRequestURL
        {
            get { return m_startsWith; }
            set { m_startsWith = value; }
        }

        public override void PostRequest(object sender, PostRequestEventArgs e)
        {
            WebTestRequestCollection depsToRemove = new WebTestRequestCollection();

            // Note : you can't modify the collection inside a foreach, hence the second collection requests to remove.
            foreach (WebTestRequest r in e.Request.DependentRequests)
            {
                if (!string.IsNullOrEmpty(FilterDependentRequestsThatStartWith) &&
                    r.Url.StartsWith(FilterDependentRequestsThatStartWith))
                {
                    depsToRemove.Add(r);
                }
            }
            foreach (WebTestRequest r in depsToRemove)
            {
                e.Request.DependentRequests.Remove(r);
            }
        }


    }

Sunday, July 27, 2014

VSTS performance testing : How to extract values from Binary format responce in VSTS

Problem : We are getting a dynamic value in Request1 response. b) But the value is coming in Binary format + text format. How to extract the dynamic value or how to add validation text.



Solution: 1. You can take the response from the recorded result. There you will have in normal format. You can use that text to extract value. How I have to extract if I loss recorded result: You can read that particular response into note pad by applying web request plug in with below code. public class Class1:WebTestRequestPlugin { public override void PostRequest(object sender, PostRequestEventArgs e) { base.PostRequest(sender, e); String text = e.Response.BodyString.ToString(); System.IO.File.WriteAllText(@"D:\WriteText.txt", text); } }

VSTS performance testing : Exception in pre web event : Could not load file or assembly ....

While running web test we are getting below error.
Exception in pre web event : Could not load file or assembly .... (PFA screenshot)

Solution: take project .dll file from BIN folder and add it into local test settings.

VSTS performance testing :How to extract dynamic values from 302 redirect requests in VSTS

Issue : We are getting dynamic value in 1st request’s (Request 1) response and it is redirected (302) to another request (say request2). The same value (which came as dynamic value in Request 1) used in Request 2. How to extract this dynamic value?

Solution:
1. Select 1st request Properties  Follow redirects = false. 2. Now you will be able to add extraction rule for dynamic value. 3. Copy the 2nd request (200 OK) and add in the web test and replace the dynamic value with extracted value. 4. If there are any extraction rules in the 1st request move to 2nd request.



Tuesday, May 7, 2013

VSTS 2010 Performance test issue 1: Context parameter "Wresult " binding missing request.


Issue:

While doing scripting for SharePoint application using VSTS 2010/2012, we have seen this issue. Because of this our tests are going to fail.
Request failed: Context parameter '$HIDDEN1.wa' not found in test context
Solution:
1.     Went to that request by click on go to web test option and have seen that it is properly bind to that variable hidden. wa.
2.     Then identified that Hidden. Result is dynamically parameterized by VSTS and showing context parameter in test result window.

3.       Then simply bind the context parameter in the request and issue got resolved.