Ask a Question

property multirow

msalvador
Frequent Contributor

property multirow

Hi guys,

I have a test case with:

1)request(REST Request)

2)data source(Verify Fattura)

3)assertion(assertion fattura)

 

In datasource, I run a query that extract more than one row, I set 2 properties cod_num_documento,imp_documento

 

I have to fetch properties results, and I use a groovy script, for the moment script below extract only one row, but I tried in different mode.

 


import groovy.json.*
import groovy.util.*
import java.util.logging.Logger

def username = testRunner.testCase.testSteps["Verify Fattura"].getPropertyValue( "cod_num_documento" ) //.ge testSuite.getPropertyValue( "cod_num_documento" )
def foo = context.expand( '${Verify Fattura#cod_num_documento}' )
//def a = ${Verify Fattura#cod_num_documento::1}
//Parse JSON content in the request
def cod_num_documento = context.expand('${Verify Fattura#cod_num_documento}[0]')
def imp_documento = context.expand('${Verify Fattura#imp_documento}')

4 REPLIES 4
richie
Community Hero

Hey @msalvador,

Can i ask, why bother with the groovy? If it's just to attribute values, why not use the embedded Datasource functionality and just move the 2nd rows content to the same row, but the 2nd column instead? Then you wont have to worry about groovy or iterating through and jumping to the next row....the embedded Datasource functionality does all the heavy lifting for you.

Cheers,

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
msalvador
Frequent Contributor

Could you please send a simple, I don't understand how to check values from a datasource

Hey @msalvador,

Sorry in your first message you indicate you indicate the issue is youre using 2 rows of data, per request and your follow up message says you want a sample to show checking the datasource.....those are 2 different things.

Do you just want an example project created with a payload that sources 2 values from a datasource file?

Is that right?

If "yes", can you publish an example payload and indicate which attributes need the values and i'll create a project with an example test case.

Also....are you looping this testcase or is it a 1 to 1 ratio of testcase to testdata record? There was no mention of looping in your post and there wasnt any mention of looping/iterating in your groovy

Cheers

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
msalvador
Frequent Contributor

Topic is to assert datasource values.

REST Response send me a value that I use for the datasource, where I run a query.

Groovy is used to data assertions.

I post a pict, that explain the situation

cancel
Showing results for 
Search instead for 
Did you mean: