Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to test a webapplication?

If I have java-webapp (servlets), what is the best way to create automated tests for this application?

Should I start a server? But that is very fragile. Should I call the servlets directly? But how can this be done? I don't know how to create a ServletResponse/ServletRequest.

And what is the best way to test the functionality of the webapp? Should I check the generated HTML-text? But if I change the templates (typo) the test is broken.

What are your best practices and experiences with testing webapps?

like image 556
Mnementh Avatar asked Nov 07 '08 11:11

Mnementh


People also ask

What is web application testing how it works?

Web testing, or web application testing, is a software practice that ensures quality by testing that the functionality of a given web application is working as intended or as per the requirements. Web application testing allows you to find bugs at any given time, prior to a release, or on a day-to-day basis.


2 Answers

Have a look at Selenium. It's a very nice tool, and should at least point you in the right direction for the integrated tests. Beyond that, use unit tests of your servlets and other support classes using JUnit.

like image 173
Nerdfest Avatar answered Oct 01 '22 12:10

Nerdfest


Look at Selenium for webapp testing, and Abbott for java applet testing. We've managed to mix the two so that Selenium calls the Abbott test via javascript. They're both tools that allow you to record actions as you view the page, and then autogenerate test code. You can modify and tweak it once you've recorded the basic test. You get beautiful tests with a minimal amount of effort. They'll name a drink after you.

like image 33
Kieveli Avatar answered Oct 01 '22 11:10

Kieveli