Disabling ExpectedResponseUrl for single request in web test
Asked Answered
A

3

6

I'm recording a web test using Visual Studio 2010.

For each request, the expected response url is recorded, and a validation rule on the test ensure that these response are correct.

The test is using random data. For a particular request, in certain case the response url may differ from what is recorded, and the test is still valid. I can handle an action depending on the response url in a WebTestRequestPlugin, but the validation rule still applies.

I tried removing the response url in the properties tab for that request, but if the field is empty, the validation rule seems to expect the same url as the request for the response.

Is there a way to disable that validation rule for that single request?

[Edit] I just think that being able to put wildcards in the ExpectedResponseUrl field for the request would be great... but that does not seems to work with a "*". [/Edit]

Advocation answered 18/2, 2011 at 19:38 Comment(0)
S
7

Try converting the test to a coded test. Then you can either write a small piece of code so the expected url will be correct, or override the validator.

You could create a custom Validation rule if you want to avoid coding the test.

Sussi answered 20/2, 2011 at 22:27 Comment(3)
Well, I supposed this is the only way, but I would like to avoid coding the test. It's a quite complicated test, and it's a lot more comprehensive visually in the editor.Advocation
Yeah, the coded test can be pretty massive. I generally put each call into a separate function. That it looks a lot cleaner.Sussi
I've done it with a CustumValidationRule, derived from ValidateResponseUrl. No coded test. Thanks!Advocation
B
4

You can effectively remove the Response URL validator on a single request as follows:

  1. In the context (right click) menu of the web test, select "Extract web test".
  2. Make sure the desired first and last requests are selected, then follow the prompts.
  3. Upon completion of prompts: The selected requests are moved into another ".webtest" file and a call of that file is automatically added to your parent webtest.
  4. Open the newly extracted web test file in Visual Studio and delete its Response URL validator.
Brom answered 20/3, 2014 at 16:3 Comment(0)
P
2

Just simply remove the Response URL rule which is added by default under validation rules. This will pass your tests and if you need to test the URLs, you can always add custom validation rules.

Pelf answered 12/3, 2014 at 15:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.