开发者

Disabling ExpectedResponseUrl for single request in web test

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 开发者_StackOverflow中文版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]


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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜