Forum Discussion
7 Replies
Sort By
- omatzuraSuper ContributorHi Ali,
by "row_count" do you mean the number of rows that have been retrieved, or the number of rows available?
regards!
/Ole
eviware.com - alibaba82Super Contributorthe number of rows that were returned by my sql query.
- alibaba82Super ContributorAlso I would like to get the items in the datasource. How can I iterate over the items returned by the datasource.
Thanks
Ali - omatzuraSuper ContributorHi Ali,
soapUI doesn't prefetch all data, so the number of rows is not available until the DataSource has been exhausted..
Regarding the iterating, do you want to iterate the DataSource from a groovy script, and extract the items for each row?
regards,
/Ole
eviware.com - alibaba82Super Contributorso basically I have a test case with 2 steps.
step1: JDBC datasource has a simple query like
select itemid from tableA
For this test to pass I would like the query to return 0 records, if it fails then I would like to throw an exception displaying all the itemid from the query.
my current step 2 is like this
if(testRunner.testCase.testSteps["jdbc_datasource"].currentRow) != 0)
throw new Exceptions ("query returned some results --> Error")
I want something like this instead
if(testRunner.testCase.testSteps["jdbc_datasource"].currentRow) != 0)
throw new Exceptions (Item1, Item2,...,Itemn)
how can I do this - omatzuraSuper ContributorHi Ali,
ok.. you would have to loop the rows to get all item values and then dump the resul, try the following:if(testRunner.testCase.testSteps["jdbc_datasource"].currentRow) != 0)
{
def ds = testRunner.testCase.testSteps["jdbc_datasource"]
def list = [ds.getPropertyValue( "itemid" )]
while( ds.next( testRunner, context ))
list.add( ds.getPropertyValue( "itemid" ) )
throw new Exception( list.toString() )
}
Does that work?
regards,
/Ole
eviware.com - alibaba82Super Contributorworks.
Thanks for the help
Related Content
- 3 years agoMoUddin
- 3 years agoLucian
- 5 years agompartyka
- 6 years agoamarnath1234