Jakarta Cactus alternate?

7.9k Views Asked by At

Greetings, we have a project with loads of beans, JSP and etc. There is a desperate need for performing automated tests in our environment (we use Maven). Now, we can easily write tests for database project layer, for various security utilities we implemented. But the JSP pages remain untested.

I searched for utilities for server-side testing and Cactus seems the best option. However, according to their changelist, their last release is 1.8 and it was released more than two years ago!

So the question is - what happened to Cactus, is it still developing or what? And what are the recent alternates for Jakarta Cactus (if any exists)?

4

There are 4 best solutions below

0
On BEST ANSWER

I've used a combination of Spring, JUnit and HttpClient with some success in recent projects.

Apache HttpClient provides a powerful and flexible API for constructing and sending http requests into your application. It cannot replicate a web browser, say by running client side scripts, however if there is sufficient content within the resulting http responses (headers, URI, body), then you can use this information to traverse pages within the application and validate the behavior. You can post forms, follow re-directs, process cookies and supply the inputs into your application.

JUnit (junit.org) drives the tests, invoking a series of pages with HttpClient and can be deployed alongside the application, run standalone with ant/maven, or run separately inside your IDE.

Spring (springsource.org) is, of course, optional as you may not be using it for your project. I've found it useful to stub/mock out parts of the application, such that I can isolate specific areas, such as front-end controllers, through to the business logic, by substituting the DAOs to return specific data values. It provides an excellent Test Context Framework and specialized TestRunners that hook in well to testing frameworks like JUnit (or TestNG if you prefer).

0
On

You might want to try selenium. That with jBehave is a good combination I'm finding. And the more support for both those projects, the more they will not go defunct (like cactus).

0
On

How about Arquillian? I haven't used it and it doesn't even have a stable version yet, but at least it's in active development.

0
On

Cactus served as a good server-side testing framework in the ejb2 ages and but it's not supported anymore.

You can use combination of both Mock testing (fine-grained) and In-Container testing (coarse-grained) strategy to test your application completely.

Mock Testing Frameworks : Mockito, Jmockit, EasyMock etc..

Integration Testing Frameworks (Java EE) : Arquillian, Embeddable API, etc..

I prefer Mockito and Arquillian for server-side testing.