Page 1 of 1

Stop if no rows available

Posted: Wed Jun 20, 2012 4:46 pm
by byonush
I have a step in my test suite that calls a stored procedure and uses some parameters. Everything works just fine most of the time. The problem I am having is sometimes the data has not populated yet and the test suite will show as passed and a message saying:

Warning: The data source is valid but contains zero data rows

After that it will proceed on. How can I make it so if no data rows are found then it will stop the test suite?

Re: Stop if no rows available

Posted: Thu Jun 21, 2012 3:11 pm
by Support Team
Hi,
byonush wrote:How can I make it so if no data rows are found then it will stop the test suite?
You can perform this, by adding a test case after the data-driven test case.
In this test case add a user code module, or a recording mit a user code action.

Add the following user code to the user code module/action:
if (TestSuite.Current.GetTestCase("<TestCase>").DataContext.Source.Rows.Count <= 0)
    Report.Failure("No Data Rows in Data Source");
whereas <TestCase> is the name of the data driven test case.


Regards,
Tobias
Ranorex Team