Did anyone created a junit test class to test IS flow/hava service?
any suggestion / best practice?
Thanks a lot!!
Did anyone created a junit test class to test IS flow/hava service?
any suggestion / best practice?
Thanks a lot!!
Hi Fabrizio,
Little late with this response, but I think what you are looking for the WmTestSuite tool.
It is actually a tool that SAG offers to customers. I have no idea about the pricing information. (some details here: wmtestsuite - webMethods - Software AG Tech Community & Forums)
Also in the mean time other tool might have been developed that will ease the testing of Integration Server services.
You can check this out: WebMethods New Tools Survey - 1 minute (5 questions) - webMethods - Software AG Tech Community & Forums
Hope it helps,
Vlad Turian
Hello,
I have developed my own Java framework for testing Flow services with JUnit. It is an abstraction over IData, so you can test the services using POJOs instead of handling IData yourself:
You can define your IS documents or Input/Output parameters as simple POJOs using public attributes or even Getters/Setters:
public class Address
{
private String street;
@PipelineName("CityName")
private String city;
[...]
}
The service is modeled as a simple Java class using lots of Reflection and Generics to minimize the needed code:
public class GetAddress extends Service<GetAddress.Input, GetAddress.Output>
{
public static class Input extends ServiceInput
{
public String id;
}
public static class Output extends ServiceOutput
{
public Address address;
}
}
A simple test may then look like this:
GetAddress sut = new GetAddress();
GetAddress.Input input = new GetAddress.Input();
GetAddress.Input.id = "123";
GetAddress.Output output = sut.call(input);
assertThat(output.address.getStreet(), is("My Street"));
Here’s an (older) blog post describing the functionality (before I extracted it as a framework): Unit-testing Flow Services in webMethods’ Integration Server with JUnit.
The framework is in use for almost two years now and is actively developed. The complete source code is on GitHub and it’s completely free, of course. Feel free to modify/add behaviour and send me a Pull Request.
I would love to get feedback on the framework! And please let me know, if I can be of further help to you.
Best regards,
Stefan
Hi Stefan,
we have implemented jUnit in our project
JunitHelper JHelperObj= new JunitHelper();
public Context contextCall= JHelperObj.connectServer(“http://localhost:5555”);
String response1=JHelperObj.jUnitHelperMain(contextCall, “PipelineFileName”, folder, svcName);
If test is positive then assetValue=true; else assetValue=false;
Hi Rohit,
thanks for the explanation! I never thought of running the tests directly on Integration Server.
However, if I understand you correctly, you also create the JUnit tests directly on Integration Server. In my opinion, this has two negative consequences:
Furthermore, my framework does not only allow unit tests to call the services, but any Java application. The framework is used as an abstraction layer on top of IS, so Java applications don’t have to deal with IData etc.
Best regards,
Stefan
IMO it’s a bit unnatural to create unit tests in a language other than the one the tested units are created in. That’s the reason for the existence of the many xUnit libraries for different languages. I think there should also be one for the flow language.
You are absolutely right! Writing unit tests should never be “unnatural” for the developers to maximize the possibility that they actually write tests. That’s the reason why we created a test framework for Natural (NatUnit) instead of using the testing tools inside Software AG Designer.
However, in case of Flow as a visual language I would not recommend writing tests with it. All the pointing and clicking gets annoying pretty fast (at least in my opinion). But that’s a general problem with all visual programming languages.