How to pass an extracted value into a referenced test suite

LegacyForumLegacyForum Posts: 1,669 ✭✭
edited December 2016 in SOAtest
This topic will describe the steps to pass an extracted value into a referenced test suite (which is unmodifiable within the scope of the current test due to being a reference).

Assume you have two different tests/tst files (1 MainTest.tst, 1 ReferenceTest.tst)

MainTest.tst looks like this:
Test Scenario:
-- Test 1: GetItemByTitle (SOAP Client Tool)
-- Response Output: XML Data Bank (extracts node value (i.e. id) to a column named "extraction")
-- ReferenceTest scenario (the reference to ReferenceTest.tst, which is unmodifiable within this scope)

ReferenceTest.tst looks like this:
Test Suite:
-- Test 1: GetItemById (SOAP Client Tool)

What we want to achieve is allow for the "extraction" value to be passed to the ReferenceTest scenario but this we cannot change the ReferenceTest SOAP Client tool to use a parameterized value from within MainTest.tst because it is a reference. Therefore we must configure ReferenceTest.tst to use parameterized values:

From within ReferenceTest.tst:
1) Double-click the parent Scenario node for Test 1: GetItemById within the Test Case Explorer.
2) In the configuration window that opens up, select the "Test Variables" tab and click "Add"
3) In the resulting dialog box, configure the following:
-- Name: Enter the exact name of the column you used in the XML Data Bank within MainTest.tst (i.e. "extraction")
-- Type: Data Source
-- Select the "Use value from parent test suite (if defined)" radio button.
-- Data Source Name: <leave it blank>
-- Column Name: <leave it blank>
-- Value: Delete the default "0" value and leave it blank
-- Click OK
-- Click Save.
4) Now you can go into the Test 1: GetItemById test (or any other tests that are children of the parent Scenario node you opened and configured) and select to "Parameterize" corresponding parameters with the "extraction" test variable name.
5) Save any changes.

For MainTest.tst:

-- To ensure that the changes you made to the Reference Test File are applied to your reference test suite scenario, close and reopen MainTest.tst.
-- If you open the ReferenceTest scenario and double-click on the "Test 1: GetItemById", you'll see that the test is configured to use a parameterized value that is named "extraction", the same column name you are using in your XML Data Bank and also as you configured in the ReferenceTest.tst.
-- You can now run MainTest.tst and notice that the proper extraction is passed to the ReferenceTest.

*I have attached two sample tst files that demonstrate this setup and behavior.
Sign In or Register to comment.