Dec 3, 2008

HttpUnit - web page testing

Two weeks ago my professor gave us an assignment about testing web applications.
It is well-known fact that testing web pages is very hard by its characteristics.

One tool that professor suggested is HttpUnit:

It is not so much surprising in the sense of technology. However, it had very interesting interface to test web pages. Most of web page testing tools mocks the behaviors of web browser. Some of them actually records tester's clicking.

One way I have come up with is using cURL to retrieve a web page and find out certain text messages by Regular-expression. By its nature web pages contains very flexible format, so that it should be check by powerful text message checker such as Regular-exp.

One of the approach of HttpUnit is parsing the HTML page into DOM tree, and returns some of parts that are interested to testers. The syntax gave me the impression that it seems like JavaScript syntax.

However, we still have difficulty of web page testing. HttpUnit requires that the target web pages had to be deploied on web server, which takes fairly long time. I don't think we can skip the deploying part for testing. We need to test the very last result, which should be resulted by a web container. For this problem, we may need a light-weight web application server inside of IDEs.


Anonymous said...

HtmlUnit is far more superior than HttpUnit.

Jay said...

Wow, you are right. It seems better. I saw HtmlUnit supports XPath, which is very nice:

Thank you for good information.