Create XML File With Variable Information

Speedy993Speedy993 Posts: 35

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_parasoftbenken_parasoft Posts: 1,018 ✭✭✭
    edited July 26

    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.

Sign In or Register to comment.