A tag in Integration Tester is a means of storing a single value for substitution in a test case. A list tag is similar, however it contains multiple values. List tags can be created in a number of ways, such as, by using the Iterate Test Data action, Lookup Test Data action, ECMA script, and by tagging a repeating element from a response. In this blog, we will discuss list tags and how to apply them to a repeating element in Integration Tester.
Step 1 - Create a simple project
For our example we will make use of the ‘Echo’ service hosted by the Test Control Panel and build a simple virtual service to help demonstrate the concept.
Navigate to the ‘Examples’ page of the Test Control Panel in your browser and locate the Echo example. Import the Echo WSDL from Test Control Panel in to a new Integration Tester project in a logical view.
Assuming the control panel is on your local machine the URL is as follows:
We can have Integration Tester create a test and stub for us automatically.
Step 2 - Configure the test
In the Send Request dialog box for the automatically generated EchoTest, provide a string value to send. Let’s use "Hello World" as shown in the screenshot.
In the Receive Reply dialog box, treat the text string as plain text and turn off the validation. Here, we're not interested in actually testing the Echo service itself but to see what the stub is returning. So, what it returns won't match the Echo response schema anyway because it doesn't support repeating elements. Hence, you need not report an error when we know the stub sends a reply that doesn't match the schema for the Echo test reply:
In addition, tag the returned text by using Quick Tag and display it in the test with a Log function.
Step 3 - Configure the test EchoTest to go through the proxy
In the Client tab for the physical resource of the EchoTest server, enter “localhost” and “3128” for the Proxy Host and Proxy Port, respectively. This is required because we will have the test hitting a stub and not the live service. The proxy will communicate with the agent and detect that a stub is running and route the request to the stub.
Step 4 - Create and populate a list tag in the EchoStub stub
The first step is to use the Tag Store dialog box to create a tag. Let's call it EchoListTag.
Now to populate the tag, navigate to the Activity tab of the stub, and choose Business Logic.
Create a function that just returns "123".
In the Store tab of this function, select Append to list of values.
Save the function. Copy the function so that EchoListTag has multiple values. Use a log statement so that we can check the actual value of the tag before we use it.
Now, run the stub in Integration Tester. Then, run EchoTest. We see EchoListTag is indeed a list tag.
Step 5 - Configure the EchoStub stub output to use the EchoListTag list tag
The response from EchoStub conforms to the schema that was used to when creating the stub, which does not allow marking an element as Repeating. We need to replace the response content with a plain XML so we can mark an element as Repeating.
The first step is to capture the current content which is in XML format by clicking the current text node and going to the Value tab. Now, select All and press Control +C keys to copy this content to the clipboard.
Paste this content in a Notepad to preserve it for the time being. Next, clear the contents of the response text string. This breaks the link to the schema and means Integration Tester will treat any new content as separate.
Double-click the text (String) and enter the XML content that you copied earlier as its value.
Ensure that the Config tab is selected. Now, right-click and mark the echoStringReturn node as Repeating > Repeat (additional child where tag value is null).
Switch to the Value tab and set the value of the text below this node to the EchoListTag list tag.
Step 6 - Run the stub and then the test
Navigate to Test Factory and run EchoStub. Then, run EchoTest.
As seen in the following screenshot, the stub returned two text values of "123".
Note: The two most common pitfalls are marking the text node instead of its parent element node as Repeating and setting the value of the element with the list tag instead of the child text node. Refer to Step 5 on which node to mark as repeating and which node to assign the value of the list tag.
This simple tutorial is a great introduction to the use of list tags and repeating elements. You need not learn ECMA script or build a stub and test from scratch. In addition, we discussed how to tag output from a reply message and display it via the Log function. For more information on tags and repeating elements, see
Paul Liskay joined the Rational team in 2009. Currently, he is a Level 2 support engineer for the Rational Testing Tools for the US geography, focusing primarily on Rational Performance Tester, Rational Integration Tester, and Rational Test Workbench Web UI. Prior to joining the support team, he was the team lead for the Rational Integration Tester 8.0 release, and a team lead for Rational Performance Tester for the 8.0 through 8.2 releases. He was also on the system test team for Rational Team Concert for the 4.0 release.
HCL OneTest API is a trademark of IBM Corporation in at least one jurisdiction and is used under license.