Soapui project:. get any specific cell value of Data source grid
Column properties are
Emp number , Emp salary, Emp Location Data is following way for above columns.
1 5000 USA
2 4000 INDIA
3 3000 Canada
......
.......
Now I want print or log or store value of 2 nd employee salary i.e 4000 ... That means I want to get any specific cell value from data source cell value.. using groovy...
- Example
Data source having following columns
Country name , Group1,Group,2, Group3
Data as follows
USA 600 700 800
INDIA 500 600 900
Uk 400 599 600
..
.......
In my loop request I am sending country name and Group ..then ApI will give slary based on given inputs...
ASo I want validate response salary is expected or not based on data source ... And validating .. Thanks .. Hey Raju506315
Ok - so to be cleaar - your datasource has 4 columns Location, Group1Salary, Group2alary, Group2Salary
you are submitting a request that contains "Location" and "Group Info" - how are you passing these? Is it a GET so the attributes you submit are part of the query filter or is it a POST when you are submitting a payload along with these attributes?
If I'm understanding you - you don't need to use groovy to verify the returned data is the same as in your datasource - you can use the OTB 'Select Content' function in your json? xml? content match assertion.
1. If you create the assertion on the relevant attribute in the response via the 'Outline' tab, 2. hit 'Select Content', 3. select the testsuite that contains your test, 4. then select the test, 5. then select the GET or POST request you are verifying the content within, 6. then select 'Property [Request]' - this launches a 'Select JSON' window (or 'Select XML' if the response is XML), 7. then select the attribute that contains the relevant value - e.g. 'Salary' and hit 'OK' - this will close the form and generate a string in your 'JSONPath Match Assertion' something like the following:
If its a GET request and your submitting the Salary as a template parameter - the dynamically generated value is something like
${TestStepName#TemplateParameterNameValue}
If its a GET with say a template/URI parameter value that is submitted - the assertion content is something like ${REST Request#Salary} - this would be via a GET as follows:
GET --> /awks/eek/whatevs/Something/GetSalaryDetails/{Salary}
If it's a POST it's a bit more complicated (cos you're picking out attribute values from the payload rather than from a query parameter in your REST request - it's something like:
${TestStepName#Request#$['attribute in request that contains the value']}
So the above approach allows you to successfully assert against the submitted values to ensure they are correct in the response.
You can use the same approach via the 'Select Content' to match values in other test steps - not just REST or SOAP requests.
Does that help?
Cheers,
richie