Prabhakar Y
Prabhakar Y

Reputation: 87

Web test fails with "404 Not Found" errors when it is run

We are doing Performance and Load Testing for Web application which is developed in Angular Java using Visual Studio 2013 ultimate.

Our approach :

  1. Record the Web test

  2. Play back the web test

  3. Do correlate and parameterize etc

The problem now which we are facing is

  1. When we record the Login scenario like enter the user name and password in the web test we are not able to find the Form parameters.

  2. While running webtest we are getting HTTP Status 404 errors for some files, they are:

    • glyphicons-halflings-regular.eot

    • fonts/glyphicons-halflings-regular.woff

    • glyphicons-halflings-regular.ttf

We have tried with the steps below to resolve the above stated errors

  1. We checked the Parse Dependents requests for each request and unparsed the dependents and the respective requests and vice-versa .

however the HTTP status 404 errors for the above files did not get solved. It is showing same error when we play back our web test.

So can anyone please help us how to resolve this error while running webtest.

Upvotes: 0

Views: 2247

Answers (2)

AdrianHHH
AdrianHHH

Reputation: 14038

One option is to discard the dependant requests before they are issued. You could create plugin to remove these dependant requests. A basic plugin to find and remove requests is below. This can easily be extended to do other comparisons, such as r.Url.Contains(...) etc.

public class WebTestDependentFilter : WebTestPlugin
{
    public string EndsWithString { get; set; }

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

        // Note, you can't modify the collection inside a foreach,
        // hence the above collects requests to remove.

        foreach (WebTestRequest r in e.Request.DependentRequests)
        {
            if ( r.Url.EndsWith(EndsWithString))
            {
                depsToRemove.Add(r);
                e.WebTest.AddCommentToResult(string.Format(
                   "Dependant request ending with \"{0}\" removed : {1}",
                   EndsWithString, r.Url));
            }
        }

        foreach (WebTestRequest r in depsToRemove)
        {
            e.Request.DependentRequests.Remove(r);
        }
    }
}

This plugin is based on code described on page 189 of the Visual Studio Performance Testing Quick Reference Guide (Version 3.6).

Another possibility is to add explicit dependant requests to the web test for these files and set the Expected HTTP Status Code property to 404.

The plugin method is relatively quick and simple. It has the disadvantage that it reduces the load on the servers and the network because the requests are not sent. The second method preserves the requests and so might be considered to be a more realistic performance test.

Whichever route you take, you might report the problem files to your customer as they appear to indicate a fault in the web site.

Upvotes: 2

Wayne Ellery
Wayne Ellery

Reputation: 7958

Add this to your web.xml file with the following:

<mime-mapping> 
    <extension>woff</extension>
    <mime-type>application/x-font-woff</mime-type> 
</mime-mapping>
<mime-mapping> 
    <extension>eof</extension>
    <mime-type>application/vnd.ms-fontobject</mime-type> 
</mime-mapping>
<mime-mapping> 
    <extension>ttf</extension>
    <mime-type>application/x-font-ttf</mime-type> 
</mime-mapping>

Upvotes: 1

Related Questions