Cargo-itest open source project

I recently started an open source project called cargo-itest. This was started up because when I worked on several projects I needed to create integration tests for them which all had similarities. I was previously doing it with the maven2 cargo plug-in but wasn't really fond of it because it most of the times didn't work and when it worked it stopped working after editing the configuration. In other words it was very unstable. This initiated me to start to use the java API of Cargo instead of the maven plugin. By using the java API it already removes the dependency from your build system in this case Maven.

Having no dependency on the build system gives you a couple of advantages:
  1. You can run it in any IDE that supports JUnit.
  2. You can switch easily to another build system without changing your tests and test configuration.
These are general advantages of just using the API but also part of using my open source project cargo-itest. This project enables you to easily start creating integration tests by just extending your unit test (JUnit 4.4) from a base class called AbstractDefaultDeploymentTest or AbstractDefaultHibernateDeploymentTest. These base classes provide you with out of the box functionality to start up a container and run integration tests on them. So to start up from scratch you need to do the following steps
  1. Extend from AbstractJBossContainerUtil
  2. Create a context file called itest-context.xml in the root of the classpath
  3. Configure the container utility in the itest-context.xml
  4. Create your own JBoss configuration ZIP file by using the test-app.zip as template since this one already contains certain variables that are used by the AbstractJBossContainerUtil and put it on a server so the container utility can download it.
  5. Put JBoss on a server in a ZIP file also so the container utility can download it.

After these steps your container utility should be setup correctly and all is left is to create a unit test that either extends from the default tests that are supplied in the project or create your own test and start the container yourself.

There are fully functional examples in the SVN repository which can be found here:

Now there is only a JBossContainer utility available since I worked a lot with JBoss but in the near future I am planning to extend it with Tomcat and Jetty and maybe in the future some other utility containers. The important part is that you can actually do it yourself if you like in an easy way without influencing your tests.

So the overal benefits for using this projects are:
  1. Without extensive knowledge of the cargo API you can start creating integration tests with fairly little effort.
  2. You can create your own container utility if the container you are using is not supported yet.
  3. You are not stuck to a build system so you can easily switch build systems without changing your tests
  4. You can run the tests within your IDE which will speed up the development
  5. It's open source so you can extend it in any way you like :-)
The project itself is hosted on Google code on this location:


Comments

Popular posts from this blog

Fastest XML parser

Tomcat behind Apache HTTP server using Spring Security