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:
- You can run it in any IDE that supports JUnit.
- You can switch easily to another build system without changing your tests and test configuration.
- Extend from AbstractJBossContainerUtil
- Create a context file called itest-context.xml in the root of the classpath
- Configure the container utility in the itest-context.xml
- 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.
- 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:
- Without extensive knowledge of the cargo API you can start creating integration tests with fairly little effort.
- You can create your own container utility if the container you are using is not supported yet.
- You are not stuck to a build system so you can easily switch build systems without changing your tests
- You can run the tests within your IDE which will speed up the development
- It's open source so you can extend it in any way you like :-)
Comments
Post a Comment