How to extract fields from response message and write to file?

trand2trand2 Posts: 8
edited June 2017 in SOAtest

Hi. I am executing some tests which require a report to be generated at the end. My test request messages are XML and are parameterized using an Excel input datasource. I'm wondering if SOATest has the following capabilities:

  1. Save request and response messages for each test scenario into a separate file, one for request, one for response (I have tried using the Write File tool, but it either appends the responses to the same file, or it over-writes the file with the response of the last test scenario). Each row in my Excel input datasource file is a scenario, I need to capture all traffic resulting from each scenario.
  2. Capture and save certain fields from response messages in either Excel or text file. Again, for each scenario that was executed.
  3. Compile a report with info from items 1 and 2 above.

The reason for the info captures above is so that test results can be independently verified (by a different party without using SOATest).

Thanks in advance for the great support!

Answers

  • OmarROmarR Posts: 177 admin

    Good afternoon TRAND2,

    Try chaining a Write File to your Messaging Client's request traffic AND response traffic separately. Configure each write file to output the information to different file names. For example,

    As for your second inquiry, try using an xml transformer to extract the desired information and use a Write file to output it to a text file.

    Give this a shot and let me know if you run into any other hurdles :triumph:

  • benken_parasoftbenken_parasoft Posts: 348 ✭✭✭

    To capture all traffic, enable the option in the test configuration to "Report traffic for all tests". Next, in the Parasoft preferences under Reports, enable "Overview of checked files and executed tests" and disable "Only top-level test suites". This way, the XML and HTML reports will capture all traffic and present that information for individual test cases.

    The XML report is intended for custom reporting purposes. It is a machine-consumable format (by nature of being XML) having all the raw test result data. Java has many libraries for working with XML documents. If you need to work with Excel, there is Apache POI.

  • trand2trand2 Posts: 8

    I have tried using a Write File tool for the responses. When Append is checked, it spits out a file with all the responses in one file. I need the responses to be separate (one file per response).

    If Append is unchecked, it only shows the last test scenario's response (it overwrite the file each time it iterates through the rows my input spreadsheet)

    In the Traffic Viewer object, i can see the request and response message pairs for each of my scenario which is exactly what i want, is there any way that one can chain a tool to that object? Just a thought.

    The Write File tool behaves the same for my second inquiry. That is: it overwrites the output file with the last scenario's response values.

    It seems the Write File tool is not the way to go here?

    Thanks,

  • OmarROmarR Posts: 177 admin

    Have you tried appending one of the wildcards below to your Target name?
    %u may do the trick, but I recommend trying them all and choosing the one that best fits your scenario.

  • Ramiro MartinezRamiro Martinez Posts: 46 admin

    Hi Trand2,

    I am a bit unclear about what exactly is your end scenario.
    Are the following requirements correct?
    1. Request and response pairs in the same.
    2. Each pair of request and response should be in a different file.

    If the above is correct then you will want to use the File(write file) tool chained onto the client's "traffic stream".

    This will now add the request and responses into a single file, now to separate these pairings into separate files you will want to configure the name of the file that is created by the Write file tool to be unique for each pairing.

    This can by adding %t to the name of the file, these characters add the time to the name. For more options Click "Help" next to the file name text box.

    Example of output of names:

    If this is not your use case and you are actually trying to separate the request and response pairs as well , then you will have to use the naming concept from this post and the "write file" tool configurations from Omar's post above.

    I suggest looking through the SOATest documentation for "write file" tool, especially the Customizing write file section as it goes into dept explaining the naming options.

    You cannot chain anything to the Traffic viewer as the traffic viewer is not outputting any data to another tool. The messaging client is outputting data, therefore it is possible to modify it with the different tools.

Sign In or Register to comment.