Unit Testing Service Component Architectures

Nice to see someone at IBM has finally taken a look at how you might test their wonderful SCA modules.

Turns out you have to go through many steps in Websphere Integration Developer (WID) and it appears to rely on Cactus which tends to be a real pain. Getting the whole thing setup involves several XML configuration files and plenty of clickety-click development. And they aren’t really coming from the perspective of test first, since you always lay out the process first using their visual modeler. I personally despise this whole style of development, but being able to actually force it into something of a test harness does make it a bit more palatable.

Getting to a green bar with an SCA module:

  • 47 steps.

    1. To import these modules into your workspace using WebSphere Integration Developer, select File => Import.
    1. In the Import dialogue, select Project Interchange, and then Next.
    1. Select the Arguments pane. Under VM arguments enter the following code(Figure 12):

    Note that this specifies the localhost and port 9080; if your server or port for HTTP requests are different, you will need to adjust this string to match your choices.</li>

      1. Select Run to initiate the test.</ul>

    Getting to a green bar testing a POJO:

    • 4 steps.
      1. Write a failing test.
      2. Implement a class and method to fix compiler errors.
      3. Implement just enough code to pass the test.
      4. Run the test for a green bar.