Topic
4 replies Latest Post - ‏2012-11-07T09:01:32Z by SystemAdmin
SystemAdmin
SystemAdmin
590 Posts
ACCEPTED ANSWER

Pinned topic Integration testing using the Maven plug-in for Liberty profile

‏2012-11-02T10:12:17Z |
I'm currently using the Maven plug-in for Liberty profile to perform integration tests.
I'm using the Maven Failsafe plugin to execute the integration tests.
Integration test involves setting up WLP, deploying an EBA file, and running the tests against the eba.

When running "mvn clean verify" the following happens :

1. clean : cleans the target folder to start with a clean environment
2. pre-integration-test : start-liberty-server : uses the wlp jar from the local repo to install the assembly, configures the wlp with my server.xml and jvm.options and starts it.
3. pre-integration-test : deploy-to-liberty-server : uses the EBA from the maven repository to deploy it to the running server
4. integration-test : executes a jUnit integration test on the deployed EBA
5. post-integration-test : stop-server : stops the server so that the next verify run can start from a clean environment.

This is all working fine, providing nothing went wrong during the pre-integration-test.
The failsafe plugin ensures that cleanup is being done when the integration tests fail, effectively stopping the server after failed tests, allowing us to perform a clean on the next run.

What the failsafe plugin doesn't do is perform cleanup when something goes wrong in the pre-integration test (ex: error during deployment). In that case the post-integration-test is not executed and the server remains up and running, resulting in a failure during the next run (clean cannot be executed as the java process is still running.

Any ideas on how-to fix this ?
  • SystemAdmin
    SystemAdmin
    590 Posts
    ACCEPTED ANSWER

    Re: Integration testing using the Maven plug-in for Liberty profile

    ‏2012-11-05T03:38:57Z  in response to SystemAdmin
    Hi,
    Have you used this repository http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/maven/repository/ to download maven plugin? And "What the failsafe plugin doesn't do is perform cleanup when something goes wrong in the pre-integration test (ex: error during deployment)" means that if errors happen during deployment, server won't stop, so clean up (delete target folder) failed? Which platform you are running, windows or linux?

    Thanks
    • SystemAdmin
      SystemAdmin
      590 Posts
      ACCEPTED ANSWER

      Re: Integration testing using the Maven plug-in for Liberty profile

      ‏2012-11-06T13:30:06Z  in response to SystemAdmin
      1. Yes, I'm using the ibm repository
      2. This occurs on all platforms ... It's not really a WAS issue. There doesn't seem a way to perform integration testing with the maven failsafe plugin that guarantees a cleanup (in post-integration-test).
      • SystemAdmin
        SystemAdmin
        590 Posts
        ACCEPTED ANSWER

        Re: Integration testing using the Maven plug-in for Liberty profile

        ‏2012-11-07T07:41:26Z  in response to SystemAdmin
        I know what the problem is: if any exception or failure happens in server start/stop or application deploy/undeploy, maven plugin will throw an exception, resulting in a build error. That's why post-integration-test doesn't execute.
        • SystemAdmin
          SystemAdmin
          590 Posts
          ACCEPTED ANSWER

          Re: Integration testing using the Maven plug-in for Liberty profile

          ‏2012-11-07T09:01:32Z  in response to SystemAdmin
          Correct ... would be nice if the ibm maven plugins had an option throwExceptionOnError=true|false so that we could silently ignore these exceptions in pre-integration-test.

          The integration tests would obviously fail but it would still allow for the post-integration-test to continue. The build would still be marked as failed by the failsafe plugin (=expected behavior)