Matt
Matt

Reputation: 4775

Run tests against WAR

The folder structure of my application doesn't resemble a WAR file. Configuration files like web.xml are in a configuration folder, message bundle/resource files are in a resources folder, resource files stored as UTF-8, etc.. An Ant build is used to generate a correctly structured WAR.

Currently, an in-container testing framework (Cactus) is being used; however, this framework is no longer being maintained.

Are there out of container testing frameworks that can explode a WAR, instead of requiring that the folder structure of the source code match that of a WAR? If the framework supported mapping of actual location of files to their future WAR location, that would also be fine.

Are there in-container testing frameworks that are still maintained?

Upvotes: 1

Views: 596

Answers (1)

Aaron Digulla
Aaron Digulla

Reputation: 328624

The options are limited. There are some other frameworks that do something similar. MockRunner is discontinued as well. Spring Mock might be an option but it's missing some features (if you need HTTP request forwarding, you'll have to extend some classes).

I had some success with Jetty since it's easy to start Jetty embedded from a test case but of course, that will really start your application as if it was really deployed which might not be what you want.

Which is why I usually try to write code that doesn't contain any dependencies to Java EE types. This way, I can test everything in any way I like.

The CI server then has a single (slow) test which it runs once in a while that deploys the whole application (including wiping the database and filling it with clean test data) and does some simple UI operations (log in, browse some pages).

Upvotes: 0

Related Questions