eeyoreeco
11 years agoOccasional Contributor
DataSource using Groovy Script
Hi Friends, Good day!
I would like to ask some help regarding using the 'Groovy Script' as my data source (since this [Datasource] functionality is not available for non-pro SoapUI).
SCENARIO:
I have this data from my excel sheet.
___________________________________
| A | B |
___________________________________
1 |From Currency | To Currency |
----------------------------------------
2 |USD | AUD |
----------------------------------------
3 |USD | USD |
----------------------------------------
4 | InvalidData | GBP |
----------------------------------------
In a Test Case I have 3 Test Step. per test step I need to retrieve the data from the
excel file (see table). How I will be able to retrieve this data and use it as my data in my
parameters ("From Currency" & "To Currency"). Thanks
MY SAMPLE Pseudocode:
1.) Open Excel
2.) Retrieve Data (Column/Row)
3.) Store the Retrieve Data from a variable. Tocurrency[2] & Fromcurrnecy[2] (via iteration)
4.) 1st Test Step use the Fromcurrency[0] & Tocurrnecy[0] (USD to AUD)
5.) 2nd Test Step use the Fromcurrency[1] & Tocurrnecy[1] (USD to USD)
6.) 3rd Test Step use the Fromcurrency[2] & Tocurrnecy[2] (InvalidData to GBP)
Sample Request: 1st Test step
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.webserviceX.NET/">
<soapenv:Header/>
<soapenv:Body>
<web:ConversionRate>
<web:FromCurrency>Fromcurrnecy[0]</web:FromCurrency>
<web:ToCurrency>Tocurrency[0]</web:ToCurrency>
</web:ConversionRate>
</soapenv:Body>
</soapenv:Envelope>
How I will be able to code this one using a Groovy Script ? Any help will be greatly appreciated! Thanks
I would like to ask some help regarding using the 'Groovy Script' as my data source (since this [Datasource] functionality is not available for non-pro SoapUI).
SCENARIO:
I have this data from my excel sheet.
___________________________________
| A | B |
___________________________________
1 |From Currency | To Currency |
----------------------------------------
2 |USD | AUD |
----------------------------------------
3 |USD | USD |
----------------------------------------
4 | InvalidData | GBP |
----------------------------------------
In a Test Case I have 3 Test Step. per test step I need to retrieve the data from the
excel file (see table). How I will be able to retrieve this data and use it as my data in my
parameters ("From Currency" & "To Currency"). Thanks
MY SAMPLE Pseudocode:
1.) Open Excel
2.) Retrieve Data (Column/Row)
3.) Store the Retrieve Data from a variable. Tocurrency[2] & Fromcurrnecy[2] (via iteration)
4.) 1st Test Step use the Fromcurrency[0] & Tocurrnecy[0] (USD to AUD)
5.) 2nd Test Step use the Fromcurrency[1] & Tocurrnecy[1] (USD to USD)
6.) 3rd Test Step use the Fromcurrency[2] & Tocurrnecy[2] (InvalidData to GBP)
Sample Request: 1st Test step
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.webserviceX.NET/">
<soapenv:Header/>
<soapenv:Body>
<web:ConversionRate>
<web:FromCurrency>Fromcurrnecy[0]</web:FromCurrency>
<web:ToCurrency>Tocurrency[0]</web:ToCurrency>
</web:ConversionRate>
</soapenv:Body>
</soapenv:Envelope>
How I will be able to code this one using a Groovy Script ? Any help will be greatly appreciated! Thanks