back

Integration tests


Guide - Jakarta Cactus

In my former Java times I used a test framework for server-side integration tests - called Jakarta Cactus.

What does it bring?

Okay, we can use NUnit for isolated unit tests. But for integration tests I want to use the real implementations of "running" services. This means: I want to insert the test code as a component!

The component starts automatically after all depending components has started. Then the console test runner of the NUnit takes the given dlls and executes the tests.

Let's express this in a picture:



We have two integration test components I1 and I2. Each one depends on all three components A, B, C - okay so far...

Now the application server infrastructure contains a addon project IntegrationTestAddon. This project contains
  • all needed references to the nunit framework
  • an abstract service implementation called IntegrationTestService : AbstractService
  • a static reference to the IRegistry instance of the running application service
  • and a call to the nunit console runner in the start method

The problem: NUnit needs the path of the assembly, which contains the test classes and methods. Therefore the service is abstract and must be extended for each integration test component. And the abstract method GetExecutingAssembly():string must be overriden, like:

protected override string GetExecutingAssembly()
{
    return Assembly.GetExecutingAssembly().Location;
}


How does it work then?

In the moment, the compile-to destination of the integration test component is set to the folder of the application server visual studio copies all needed dlls to the correct destination (manual start -> copy all necessary dlls manually!):
  • IntegrationTestAddon.dll
  • nunit.core.dll, nunit.core.interfaces.dll, nunit.framework.dll, nunit.util.dll, nunit-console-runner.dll
  • The integration test assembly's dll
  • The integration test component description and spring configuration xml file

That's it! Check the solution of the complete project (Sample components)...

back

Last edited Jun 8, 2010 at 6:08 AM by harkon, version 5

Comments

No comments yet.