App Connect Enterprise v12: Executing unit tests in a maven CI/CD pipeline
In my previous blog, I’ve created my first v12 unit test project. So I was wondering how I could include this test project in a CI/CD pipeline using maven. I decided to create a small proof of concept.
As-Is situation:
When I commit changes to my git, a maven build is triggered that creates my bar files and pushes them in my nexus repository. This nexus repository is used to deploy the code to my runtime.
Goal:
I want to be able to execute my unit-tests in my maven build step, preventing the bar files to be pushed to nexus when the tests fail.
For my current maven builds I use this plugin. Follow the link on how to use and install the plugin.
https://github.com/ot4i/ace-maven-plugin
This plugin v11.39 is created for App Connect Enterprise V11, but also works on App Connect Enterprise V12.
I’ve tried to use this plugin to build the test project but didn’t manage to find the correct configuration.
The plugin uses the mqsicreatebar or mqsipackage bar and I could only build the test-project with the ibmint command. So I made some changes to the plugin to support the ibmint command to facilitate the build of the testproject.
Changes I’ve made to the plugin for my poc:
- lifecycle-mapping-metadata.xml: added ibmint-package
- Components.xml: added
- Added the mojo class for this component. It’s basically a copy of the CreateBarMojo with some changes in some methods
- Changed the pom of the plugin to use a new version v12.1
After installing the new version of the plugin I can continue with the project structure.
Setup Project structure:
Quick workspace recap: I have 1 application and 1 test project that can test the application in my workspace.
3 modules:
SimpleUnitTest => application
SimpleUnitTest_Test => test project
Distribution => gathers all bars + test to execute and executes the tests
Parent pom.xml
Application pom.xml
Packaging: ace-bar
Test project pom.xml
Packaging: ace-ibmint-bar Is new due to my changes in the plugin
ibmintVerb: verb required by the ibmint command
serverInstallDir: location of the ibmint executable
Distribution pom.xml
Plugin: creates a zip file containing the bar files in the maven phase package
Plugin: executes a script to execute the tests
Distribution.xml
Test.cmd
Line 09: create integration server workdir in temporary location
Line 13: unzip the distribution zip file
Line 17: deploy all bar files that are in the bar folder of the zip
Line 18: deploy the testproject
Line 22: execute the test project.
Result:
Execute in the main workspace folder: mvn clean install
Test it when the unit tests fail.
Kim Meynendonckx
IBM Integration Specialists
Enabling Digital Transformations.
Let's get in touch...
Find us here
Belgium
Veldkant 33B
2550 Kontich
Netherlands
Utrecht
Van Deventerlaan 31-51
3528 AG Utrecht
© 2019 Integration Designers - Privacy policy - Part of Cronos Group & CBX