how to create CSV files (editable in Microsoft Excel) from Data extracted from tests

[Deleted User][Deleted User] Posts: 0 admin
edited March 2017 in SOAtest

Often you will want to extract values that are returning from a test and write them into an excel file. This could be useful when building data sources dynamically from previous tests. SOAtest does not have a native interface to create Microsoft Excel files, however we can easily create CSV files that can be read by our CSV data source and can be edited by Excel.

To accomplish this we will utilize the XML Transformer to extract the values we want to write into our CSV file and then utilize a Write file tool to create the file
1. Start by attaching an XML transformer to the Response envelope of the your client
2. Double click on the elements that you wish to extract

3. You then want to combine the XPaths to ensure the values print out to one line (as it is now
they will create 3 separate lines
a. To do this start by double clicking on the first Selected XPath and copying the XPath to
a notepad
b. Go ahead and copy all of the selected Xpaths
c. Your note pad should look similar to this
d. You will now add the pipe character in between your statements this will add the values to
one line
e. In the XML Transformer go ahead and Remove all of your extractions but one

f. Double click this Selected XPath and Paste in the combined XPath into the XPath field
g. Click Evaluate to ensure you are extracting the correct elements

4. We now want to add commas between each extracted value
a. Drop down the Options Arrow and select Allow Alteration

b. Click on the new Alter Tab and select the elements again(this time we are altering their contents)

c. Double click on each element and select Append and put a comma in the Value field (don’t add a Comma to the Last element)

5. We now want to create the new line between each run (or data source row)
a. Open the Extract tab in the XML Transformer
b. Click on any element and press “Add XPath”
c. Select the new XPath and click Modify

d. Change the XPath to concat('',/n),
Please note that the quotation marks above, are two single quotation marks ' and not one double quotation mark ".

e. Press OK
f. This will append a new line
g. Save the XML Transformer
6. The final step is to write the values into a CSV file
a. Right click on the XML Transformer and select Add Output
b. Select the write File tool

c. Configure the WriteFile to create a CSV file. You can find the documentation on using the WriteFile tool in the SOAtest Documentation here: Parasoft SOAtests User's Guide > Reference > Available Tools > Write File
d. Be sure to check the Append Check Box (this continues to write to the file instead of overwriting)
e. Once configured the tool should look like this

The tools are now properly configured. You can use this method to load up the CSV file with values. In addition to this you will be able to edit these values with Microsoft excel as well as using the Excel and CSV data sources.

This technique can also be used to load up a data source that you will eventually use in a Virtualize Responder as the Data Source correlation.


  • reactancexlreactancexl Posts: 78

    Has anyone actually got this to work? This seems really simple but It does not work for me.

  • OmarROmarR Posts: 176 admin

    What portion of the workflow are you having trouble with? Is there an error you're seeing?

  • reactancexlreactancexl Posts: 78

    I have two repeating nodes. On the alter tab I xpath (all occurrences) for each and append a comma on the first node, not the second. On the extract tab i randpoml picked a node and replace the xpath with concat('',/n). when run I get zero bytes. I would expect the output would be two columns on the csv (one for each node). I have tried several different methods.

  • reactancexlreactancexl Posts: 78

    I can get it to work horizontal, where I have node1 comma separated values on first line and node 2 comma separated values on line2. The concat('',/n) just does not work and the only way I get close is doing it this way. Here is my screenshot.

  • sujaldaliasujaldalia Posts: 27

    Any update on this? I'm having similar problem that concat(''/n) does not split the records

  • Ireneusz SzmigielIreneusz Szmigiel Posts: 106 ✭✭
    edited October 2017

    I'm using similar approach, but with string-join and concat.
    In my case XML Transformer with following Xpath in Extract part:
    looks like bellow and works like a charm on my side. :)

    Then you just need to add WriteTool to save output on filesystem.

    Be aware about codepoints-to-string usage, it will create CSV file with MS Windows format (CRLF) and that you may need to wrap texts with double quotes (or other delimiter) for MS Excel.
    Ireneusz Szmigiel

  • Shashi7403Shashi7403 Posts: 5

    Hi all, getting save the csv file but in file value not get reflected .

  • Shashi7403Shashi7403 Posts: 5

    Any one can help one scenario ?
    1. I have one request with multiple data and want to hit the client .
    2. Client will response one unique id.
    3. I have to save unique id and then once aggai have to hit the client.
    4. Client will give response based on unique id .
    5. In response dependent on first request where we have data.
    Example :** Request**



    **Response **


    Above Unique id.
    Response :based on above request data getting response


    I want to store First Request and second response in CSV file then based on second request , i want to fetch the data and setup the final response.

  • jakubiakjakubiak Posts: 212 ✭✭✭

    Hi @Shashi7403, if I understand your scenario correctly you don't need to use a CSV file to handle your scenario. You can simply save the value from the first response using a data bank, and then parameterize your second request using the parameterized value. The data bank will allow you to store and reference the value without needing to write out a CSV file. Please let us know if that works for you.

  • Shashi7403Shashi7403 Posts: 5

    Thanks Jak. I have tried with Data Bank but not yet archive the GOAL :-(
    But the problem is we have multiple same child node which have different value .
    So first Request need to save in Excel or CSV. (This approach i am trying do that)
    from the first request will get response as Unique ID. (This Unique have to save and also want to map with first request).

    Now once again have to get above Unique id and then have to sent to client.
    Now finally will get ACK Response where data belong to first request.

  • jakubiakjakubiak Posts: 212 ✭✭✭

    The fact that you have multiple child nodes with different values does not require you to save as CSV. The only time you would need CSV is if you need to save those multiple values. If you need to save only a single value, a data bank will work as long as you create an XPath that extracts the exact value that you need. So how many values do you need to save to send in the second request?

  • Shashi7403Shashi7403 Posts: 5

    Not able to generate CSV file in system location.
    i have follow the above steps. but still no luck :(

Sign In or Register to comment.