Data source zero rows warning displayed when data is present

Ranorex Spy, Recorder, and Studio.
dochoa
Posts: 29
Joined: Tue Jul 16, 2013 11:36 pm

Data source zero rows warning displayed when data is present

Post by dochoa » Tue Dec 01, 2015 4:34 pm

Using:
Ranorex version: 5.3.0.22324
.NET Runtime Version 4.0.30319.34209

I have a long test where It is run for 3 iterations, but each time for a different "customer"

If I run the customers tests separately, all source data is found and the tests run as planned.

But, when I run the test to iterate through each "customer" the 3rd customer gets data source warnings of:
Warning: The data source is valid but contains zero data rows
and suddenly can't find the data rows.

How do I get it to find rows that if I use the same query I get them just fine?
Is there a data source reset step I can put in that will still iterate through the customers correctly?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Data source zero rows warning displayed when data is present

Post by Support Team » Thu Dec 03, 2015 9:52 am

Hi dochoa,

First, I would suggest updating to the latest version of Ranorex, 5.4.4.
There have been some changes regarding data sources in the latest versions.
More information about the changes can be found in the release notes.

I'm afraid I'm not exactly sure how your Test Suite is structured.
May I ask to upload your compressed Ranorex Solution?

Additionally, I would need to know which type of data source you use (Excel, CSV etc.)?

This would help me analyzing the issue.

Regards,
Johannes
.
Image

dochoa
Posts: 29
Joined: Tue Jul 16, 2013 11:36 pm

Re: Data source zero rows warning displayed when data is present

Post by dochoa » Thu Dec 03, 2015 4:41 pm

Hi Johannes,

Thank you for the reply.

I am using a SQL database as my source, I use stored procedures in the database to dynamically update my data source based on variable values.

I have attached the compressed solution as you asked (I am aware it could use some refactor, but I am new to coding in general).

Thanks again,
Dan
Attachments
Zodiac.Cmt.Automation.zip
compressed solution
(4.78 MiB) Downloaded 54 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Data source zero rows warning displayed when data is present

Post by Support Team » Fri Dec 04, 2015 2:24 pm

Hi Dan,

Thank you for uploading the compressed Solution.

It seems like updating the test data during run time is causing the issue.
I'm afraid I'm not exactly sure to which extend you manipulate the test data, but I assume that this is the reason that no data can be retrieved for the third customer.

I would suggest implementing a procedure, which resets the current test data to its initial state.
This procedure could be executed before the test case for the third customer begins.

Regards,
Johannes
.
Image

dochoa
Posts: 29
Joined: Tue Jul 16, 2013 11:36 pm

Re: Data source zero rows warning displayed when data is present

Post by dochoa » Mon Dec 07, 2015 5:01 pm

Hi Joannes,

I would like to try adding a step to reset the data, but I am hving trouble finding the right command in the API documentation.
Where should I look> What command(s) reset data sources?

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Data source zero rows warning displayed when data is present

Post by krstcs » Mon Dec 07, 2015 8:11 pm

I do this all the time and have no issues. My data is all in SQL Server and I use a very dynamic test structure where test cases are run, or not, depending on the data shape at runtime.

These are the two methods I use (one is a convenience method for string.Format()):

Code: Select all

        public static void SetupSqlDataConnector(string dataCacheName, string queryString) {
            ((SqlDataConnector)DataSources.Get(dataCacheName).Connector).Query = queryString;
            DataSources.Get(dataCacheName).Load();
        }
		public static void SetupSqlDataConnector(string dataCacheName, string queryFormat, params object[] paramsArray) {
			SetupSqlDataConnector(dataCacheName, string.Format(queryFormat, paramsArray));
		}
Call one of these in a user code module RIGHT BEFORE the test case that has the data connector you want to change. Make sure you add appropriate variables and bind them and you should be good to go.

So, if your test suite looks like this:

TestSuite
--TestCase1 -> DataConnector1
----DataManipulator1(Value1, Value2) -> DataConnector1.Column1, DataConnector1.Column2
----TestCase1a ->DataConnector2 ***This connector's SQL Query will now be updated for each row in DataConnector1
Shortcuts usually aren't...