2

In webmethods (Software AG), is there a way to Mock object during unit testing? or any available tool to test flow service.

user3431327
  • 135
  • 4
  • 14
  • I'd really like to know the answer. I tried the google and [this one](http://www.cloudgensys.com/CATE.html) seems promising, but I have no experience with it... – Betlista May 22 '16 at 14:11

4 Answers4

3

You could have a look at the Open Source http://www.wmaop.org test framework that allows general mocking and unit testing along with a host of other functionality. The framework allows you to:

  • Create mocks of IS services
  • Apply conditions to mocks so that they only execute when the pipeline contents meet that condition
  • Raise an exception based on a condition or in place of a service
  • Capture the pipeline to file before or after a service is called
  • Modify or insert content into the pipeline
  • Have a series of conditions for a mocked service with a default if none of the conditions match
  • Create assertions that can apply before or after a service so that its possible to prove a service has been executed. Assertions can also have conditions to verify that the pipeline had the expected content.
  • Return either random or sequenced content from a mock to very its output every time its called
  • Create mocks using RESTful calls so you can use alternative test tools, such as SOAPui, to create them as part of your integrations test
  • Use the JBehave functionality for Behaviour Driven Unit Testing within Designer and execute tests with the in-built JUnit.
2

WmTestSuite could be a good tool for you (Why reinvent the wheel), your company chose webMethods to speedup devs, i advice you to keep going.

What wmTestSuite does:

  • Create unit tests Graphically for you flows in the Designer
  • Generate the related TestUnit class (you can complete it to add some asserts)
  • Add a hook the Integration server to "register" data to create test data
  • Mock endpoints to ease tests (db, ws...)

I got this slide from a SoftwareAG guy. From the version 9.10 (April 2016) you should be able to download it from empower. enter image description here

1

You cannot define mocks in webMethods directly, as it requires you to hook into the invoke chain. This is a set of methods that are called between every flow or java service invocation. They take care of things like access control, input/output validation, updating statistics, auditing etc.

There are various tools and products available that leverage this internal mechanism and let you create mocks (or stubs) for your unit or system test cases:

  • IwTest, commercial, from IntegrationWise
  • WmTestSuite, commercial, from SoftwareAG
  • CATE, commercial, from Cloudgensys
  • WmAOP, open source, www.wmaop.org

With all four you can create test cases for webMethods flow/java services and define mocks for services that access external systems. All four provide ways to define assertions that the results should satisfy.

By far the easiest to work with is IwTest as it lets you generate test suites, including mocks (or stubs), based on input/output pipelines that it records for you. In addition to this it also supports pub/sub (asynchronous) scenario's.

idbaat
  • 11
  • 3
0

Ask your Software AG liaison about webMethods Test Suite (WmTestSuite), which plugs into the Eclipse-based Designer and provides basic Unit testing capabilities.

Mocks per se are lightweight services that can be configured in the WmTestSuite dialog alongside the (test) input and (expected) output pipelines.

andreas
  • 21
  • 3