Forum Discussion

cnanju's avatar
cnanju
Occasional Contributor
8 years ago
Solved

How to read the current executing excel row-column in a Groovy script test step?

Hi , I am using excel file as data source. How to read the current executing excel column in a Groovy script test step? I tried right click and GetData option but log.info is showing empty. Also ...
  • cnanju's avatar
    cnanju
    8 years ago

    Hi nmrao,

     

                          Thanks for elaborating the question. What you have explained above is exactly what I was looking at.

    With little bit of playing around with the "SoapUI NG Pro" I could generate the script to read a particular column from the currently executing row.

     

                       Now here is my test case's steps:

    1. Groovy script Test Step: Read column from excel to property (defined in test case)
    2. Execute a Parameterized Rest request  getting value from the property
    3. Groovy script Test Step: read the response and compare that with the response/expected value in the excel column along with some business validation check using assert

    I am glad that "SOAP UI Pro /Ready! API 1.9.0" has done a wonderful job of "generating the script to read data from data source for the currently executing row". Here is the steps to do that

    • Just right click on the Groovy Script Test Step editor,
    • Click On "GetData" 
    • Select the data source from where to read the data, in my case it was the added excel file's column
    • editor will ask for some meaningful parameter name, enter and click OK

    That's all you are done with the Groovy script which will read the column from a data source for the currently executing row.

    I guess it's one of the top features which should have been listed or added as video demo mentioning how to work with Data source.

    This whole thing is my personal favorite and I call it Dynamic data driven test, as I am able to test almost anything with this approach. Many a thanks to SOAP UI Pro team for building such a wonderful feature. I am thrilled.