Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Create XML File With Variable Information

Options
Speedy993
Speedy993 Posts: 52

I have a SOATest test suite with a test will drop an XML message on a message queue. The processing of this message is what the test suite will be testing. The issue is that I need to replace one of the elements in the XML message with a value that is generated at run time earlier in the test suite. That value is stored in a Writable Data Source but I am not sure how to insert that value into the XML file at the correct location. I have done a lot of searching both online and in the SOATest Help section but not found something that would work.
Could I have the beginning and ending parts of the file saved to a relative file path and then append the variable value to the first part and then append the second part to that? That seems more complicated than it should be.
Or could I have the file defined in the test as text and then some how place the variable information in the correct location in the text and save it as XML?
Thanks for any assistance.

Comments

  • benken_parasoft
    benken_parasoft Posts: 1,235 ✭✭✭
    edited July 2021
    Options

    That value is stored in a Writable Data Source

    A Writable Data Source is typically used to store an array or list of values that were extracted from something else. Typically you would have one test scenario that populates rows an columns and then a second test scenario that iterates over the data one row at a time. Is this what you are doing? If you are just storing a single value then consider using a plain data bank column or test suite variable instead.

    Or could I have the file defined in the test as text and then some how place the variable information in the correct location in the text and save it as XML?

    How are you placing the XML message on the queue? Messaging Client tool? If you use the client's Literal view then you can reference data source, data bank, or test suite variables directly in the literal message using the syntax ${name_of_variable_or_column}. If you instead switch from the Literal view to the Form Input view then you can also select "Parameterize" to use a column or variable for the element's text value, or replace the element in its entirety using the right-click "Replace with Data Source Value..." action.