Masking a 404 error in a dependent request

There are times when your web test may fail with a 404 error in a dependent request (like a css file or gif), but you may not actually care about this error. For example, it may be something that doesn’t really impact the layout or content of the page. Or you might file a bug and temporarily want to suppress the error until it is fixed so they can find other errors.

If you get a 404 error in a dependent resource, here’s how you can mask it.

Here’s a failing web test, it is very simple. If I expand the top request I can see it is failing due to a failed dependent request.


To mask the request, right-click on the dependent and hit Copy.

Go to the test, right click on the corresponding request in the test and select “Add Dependent Request”. Paste the url on the clipboard into the url property for the dependent request:


Now set the expected http status code on the dependent to 404.


Rerun the test to see it pass.


Hope that helps,


Comments (20)

  1. Prem143 says:

    Hi Ed,

    The above process for Masking a 404 error was really helpful.

    But say if the dependent request are dynamic ( by which I mean it keeps changing) and throw a 404 (as image do not exist) then how to mask those error?

    Thank you in advance.



  2. Ferretking says:

    Hi Ed,

    Solved an issue we have been plagued with for a while.


  3. Harsh Asher says:

    Hi Ed,

    The above solution was really helpful.

    Thank you very much.

  4. Curtis K says:

    This is a neat undocumented feature.

    HOWEVER, note that this technique ONLY works on top-level requests.  It DOES NOT work on dependent requests (e.g. when a dependent request itself makes a failing dependent request), and it also does not work on requests within transactions.

  5. Renrut says:

    This seems really hacky and if you have a CDN that is not delivering all the images you need on a site it would take a lot of manual effort to mask these 404 responses for images.  Is there not a way to do this in a programmatic solution where if the dependency request is an image and the response is a 404 to ignore the dependency request?

  6. Rom says:

    You can still go through a webtest plugin and parse all the pages before testing your site: I personally use this before launching a stress test to create empty images for all missing items.


    public class WebTestDependentFilter : WebTestPlugin


           public override void PostRequest(object sender, PostRequestEventArgs e)


               base.PostRequest(sender, e);

               foreach (WebTestRequest r in e.Request.DependentRequests)


                   r.PostRequest += new System.EventHandler<PostRequestEventArgs>(r_PostRequest);



           void r_PostRequest(object sender, PostRequestEventArgs e)


               if(e.Response.StatusCode == System.Net.HttpStatusCode.NotFound)


                   e.Request.Outcome = Outcome.Pass;

                   System.Diagnostics.Debug.WriteLine("Dependent request not found: " + e.Request.Url);





  7. selvakumar.g says:

    Dear ED ,

    Your notes is very helpful  for my web test.

  8. Laxmi Ramya Busetty says:

    Thank you! This was really helpful!

  9. Santi says:

    Really great solution.helped me alot.

  10. Jacky says:

    Hi Rom,

    could you please explain how to run this plugin to parse all sites before testing?  I already created the plugin and inserted it to my  Web Test Plug-Ins for the webtest level.  but this is doing nothing and the test keeps failing with 404 error.  I am sure I am missing something but I can't find an explanation.   I would appreciate your help

  11. Ramesh Pydi says:

    Nice Article and it helped me a lot !!

  12. parul says:

    Hi ED

    The above process for Masking a 404 error was really helpful. But say if the dependent request are dynamic ( by which I mean it keeps changing) and throw a 404 (as image do not exist) then how to mask those error?

    Thank you in advance.

  13. Saranya Rajendran says:

    It was really useful. Thanks.

  14. Ed Glas says:

    @parul, see Rom's request plugin code above. It will handle dynamic dependent requests.


  15. RK says:

    Its giving an error "Validate Response Code Validation '200 – OK' does not match the expected status '404 – NotFound'."

  16. MikeBCh says:

    I think in the Microsoft they can move their butts and come up with some better solution. In JMeter all the dependent requests are recorded and the only thing you should do is to delete the request. C'est tout.

    The article was very helpful, thanks a lot

  17. Hisham Samara says:

    You could change the poperty of Parse dependent requests to false on web requests

  18. Ranbir says:

    I am following the same approach which is described by ED Glas in his screenshot but not able to fix the issue.

    Anybody can help me how to resolve this one in other way.

  19. Brett Slaski says:

    This also will not work if you are using variables for servers: I.e. {{server}}/Pops/Styles/font-awesome.css

    If the dependent calls need to be run the should be recorded with everything else (like jmeter does).  Or perhaps a way to ignore the response codes to dependent calls altogether, but still call them.