2

I am trying to test an input field to make sure it is behaving correctly with invalid input. But when I try to insert text with quotes and add a validation rule for it, the test fails. It seems that I have some problem with the special characters. I tried to replace them in the validation rule with &quot, but it doesn't work. I had a similar problem when I tried to test for <> characters, but when I replace them with &lt;&gt; in the validation rule it works.

How can I test for quotes in my input with Visual Studio?

4
  • Typically you don't field validation during performance testing. Is your question really about performance testing? If not, revising it might attract more answers.
    – user246
    Commented Jun 16, 2011 at 12:40
  • True, but as I have worked with the web performance tests in Visual Studio unless things are worked out exactly right you get a lot of false negatives. Sometimes its also easier to make a web performance test rather than a CodedUI test since they run differently.
    – MichaelF
    Commented Jun 16, 2011 at 17:01
  • I'm not super familiar with the web perf test makeup, so I'm not sure where you're adding the validation rule to try this myself. However, if & gt; (space added so it will print) works, you can probably use & quot; for the quotation mark.
    – Alan
    Commented Jun 17, 2011 at 5:46
  • Never mind - I looked at the unformatted questions, and see that you tried that already. (& quot;)
    – Alan
    Commented Jun 17, 2011 at 13:59

1 Answer 1

2

Unfortunately Visual Studio Webtest was not built to validate the parameters but more to put load on a server as all it does is send a HTTP request and retrieve the request in raw format with all the headers and validates the request in its raw form. Hence you are getting the escaped characters due to the encoding performed.

If you want to get around it, write your Webtest and then generate the code from the script within Visual Studio and then modify the validation script from a code level. Or create your own validator to verify the request.

If you want a better understanding of how the requests come and go, use Fiddler to analyse the incoming and outgoing packets.

2
  • Actually that is incorrect, you CAN put validation rules in there. Whether or not its wise to do, is hard to say. But I agree, its not the best method to be using for this particular test.
    – MichaelF
    Commented Jun 20, 2011 at 12:19
  • Yes you can validate such things such as http responses and a host of other things out-of-the-box but they all basically analyse the raw http request form, apart from the basic validations such as response headers, the rest are generally flaky and give too many false negatives. If field validation is truly a necessity, then I would say that it should be done in code. For HTTP header validation and simple validation, yes out-of-the-box validation is there and quite sufficient.
    – Adrian Lai
    Commented Jun 21, 2011 at 1:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.