Home > FAQs > How can we test applications? |

Apache Struts 2 Documentation
How can we test applications?
Edit Page Browse Space Add Page Add News

First, push as much business and data access logic as possible out of the Action class and into a POJO facade that the Action can call. In this way, you can test all that outside of the Action. The MailReader is a fair example of this, although the data access API is quirky and could be streamlined.

After that, what's really left to test is the UI. For UI tests, a very good choice is Selenium.

The Selenium IDE (a FireFox plugin) includes a recorder to help jump start the tests, and then you can go back and edit the tests, and also add test that can't be easily recorded. (Like is a control disabled or text not present.)

The best part is that the initial tests can be recorded in HTML and the convert to real Java code. The Java code can then be run as part of a standard JUnit test (if the Selenium proxy server is running in the background).