Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

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?

Have a nice day :)

share|improve this question
    
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 Jun 16 '11 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 Jun 16 '11 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 Jun 17 '11 at 5:46
    
Never mind - I looked at the unformatted questions, and see that you tried that already. (& quot;) –  Alan Jun 17 '11 at 13:59
add comment

1 Answer 1

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.

share|improve this answer
    
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 Jun 20 '11 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 Jun 21 '11 at 1:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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