Question

I have never done any middle tier testing before and I am brand new to Struts. I was assigned the task to find out if it is possible to do middle tier testing of a Struts website and how to do it if it is. I wonder if anyone has experience writing middle tier tests for a website built using the Java Struts framework. If you do, 1) do you find it difficult to do so/would you recommend to just test the website in the UI level? 2) do you have recommendation of any websites or books I should go to/read to learn how to do so?

In case it helps, the website is using tiles in the UI and hibernate.

Was it helpful?

Solution

First of all, it does not matter what frontend technology you are using, if you want to test your middle tier. It more depends on your system's architecture, e.g. it will be hard to test separately when all your business logic is implemented in Struts Actions.

Please check out Uncle Bob's article "The Test Bus Imperative", where he explains how your applications should be structured to enable middle tier testing.

Furthermore, read Michael Cohn's blog entry about the Testing Pyramid, which should give you a hint of how to structure your automated tests. There you will see to create GUI based tests, but also that those should not be the majority. Additionally, you can get some information about GUI testing here.

So, first locate your actual business logic and than verify how hard it is to test it separately (without clicking around at the GUI). If that is not possible you probably should stick with GUI tests, using e.g. Selenium. Here are some guidelines for doing so without shooting yourself in the foot :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top