Jagannadh,
> I figure in my previous postings that I should have been more clear
with my
> question.The web page I want to test includes JavaScript for some
fields. If those
> particular fields do not have a value in them, an alert box comes up,
after pressing a
> Submit button. I want to be able to generate those alert boxes. Is
there anyway to do
> that?
If I understand you correctly, you want to use HTTP::WebTest to mimic a
graphical user agent (that is, a web browser) with all of its behaviour.
That means that you acttually have to parse the results as a browser
would do, including JavaScript.
This is not what WebTest does. The webtest modules can only act on a
retrieved document from the web (which can be anything) and perform lots
of sanity tests on that content. This means that you can perfectly
monitor expected behaviour of a known website.
Example:
WebTest requests a URL, like http://my.site/start.html
WebTest inspects the result (e.g. looks for a terminating </html> tag)
WebTest generates a report
(there are a lot of more elaborate examples in the documentation -
recommended!).
However, this has nothing to do with the fact whether this content
renders properly on a standard web browser. In other words, WebTest is
not a QA tool for acceptance tests , just a generic and versatile
monitoring tool to see if an existing situation doesn't change in an
unexpected way.
If you want to test your (cgi-) form application for certain responses,
nearly everything is possible with WebTest (just send a malformed
request and check for the expected error message). If that means that
this response contains specific JavaScript code (like a custom error
message) you can just check for this.
On the other hand, if you want to display popups, generated from a web
browser by means of JavaScript, you should use your web browser. At
least, that's what I think...
Cheers,
Joe.
|