Skip to main content

Image

Image

2019-04-29-Enfo-web-095.jpg
Blog

Framework for integration testing - to code or not to code

Content sections

Image

Thomas Dahlman

Text

If you look online, many of the tools and frameworks you’ll find are based on UI test automation. It’s hard to find adequate tools that allow you to test beyond the UI. This seems counter-intuitive for at least two reasons:

  1. All best practices in testing state that the closer to the code you are when finding bugs, the better it is.
  2. Currently, with sprint-based development cycles and continuous integration, automation is of the essence. Moreover, integration testing is suitable for automation.

Personally, I believe that component integration testing and system integration testing are neglected or have low priority due to its complex nature. It is far from UI:s, it involves challenges such as getting hold of key personnel with knowledge of several systems or applications and preferably get access to these systems’ endpoints.

 

Citrus seems promising

I was recently recommended to have a look at the Citrus framework. Citrus is an open-source framework for automating integration tests for basically any messaging protocol or data format. It is an automation tool for testing enterprise applications. Whether HTTP, JMS, mail, FTP, Kafka or databases, Citrus integrates common interfaces into your test framework.

Regression testing and continuous integration seem easy using Citrus because it is written as a usual Java unit test. You can use Citrus with JUnit or TestNG in order to integrate with your application.
 

Test cases can be implemented in either XML or Java:

1. XML – you can supposedly write your test case without having to write Java code at all. As well as simply code it in XML. Let me get back to this shortly.

2. Java – another option is using Citrus in Java to write your Citrus test case as you would go about in a Java unit testbut with a Citrus flavor.

With knowledge of message content (header and payload) for XML, CSV, SOAP, JSON or plain text messages Citrus is able to validate the incoming data towards it and is thereby designed to provide automated integration tests for typical use cases.

In an arbitrary test scenario, the system under test is deployed on some application server and interacts with Citrus over various message transports. During the test run Citrus is able to act on both sides as client and/or server simulating request orresponse messages. With each test step, you can validate the exchanged messages with expected control data.

 

Citrus for non-programmers

I’ve been doing a bit of this, a little of that over the past ten years. Test scripting, test management, I’ve been a team manager and even office manager. Programming is fun, I chose the IT engineering path since I like systems, business information flow and business logic. I find scripting very creative. However, I’m no coder. And here enters the contra part of Citrus.

For me, who once learned to code in the Microsoft eco system followed by what was once called web programming, it does take a while to get the grip of the java world. Maven, Spring, tags, dependencies and jar files are cumbersome obstacles that need to be overcome. Yes, you can write the actual test cases in xml, but you still have to know your way around java and all the things around your test case. In addition, most examples are in java.

That said, I still think Citrus is an interesting framework and I enjoy using it more and more. What are your thoughts? How do you ensure good testing of integraions? Do you have experience from Citrus or any other integration testing.

 

For any questions feel free to contact me:

Thomas Dahlman   

Integration QA Manager             
thomas.dahlman@enfogroup.com 
LinkedIn

 

Share