CRITICAL: SQL Data connector query not updating correctly

Bug reports.
krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

CRITICAL: SQL Data connector query not updating correctly

Post by krstcs » Fri Mar 27, 2015 7:29 pm

Ranorex 5.3.1 (worked in 5.3.0)
Windows 7

When attempting to update SQL Data connectors on the fly (which I have been doing for years), Ranorex does not actually update the query after the first time, so all the data sets are exactly the same.

I changed no code in my tests when moving from 5.3.0 to 5.3.1 and now these tests no longer work.

Code: Select all

((SqlDataConnector)DataSources.Get(dataCacheName).Connector).Query = queryString;
This is a critical issue for us because 90% of our tests work this way, which means 5.3.1 is not usable.

In the mean-time, I've rolled back to 5.3.0.
Shortcuts usually aren't...

mojohlic
Posts: 31
Joined: Thu Oct 11, 2012 4:37 pm

Re: CRITICAL: SQL Data connector query not updating correctly

Post by mojohlic » Fri Mar 27, 2015 10:40 pm

Same here. was this on purpose?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: CRITICAL: SQL Data connector query not updating correctly

Post by odklizec » Sat Mar 28, 2015 8:02 pm

I'm too experiencing a problem with the data connectors, but in my case, it's excel connectors. I'm accessing them via code and after few iterations, values I'm getting from code are wrong. I already reported my problem to support. I skipped 5.3.0, so I'm not quite sure the same problem was not there. But I guess the problems we are recently experiencing are related to the data connector optimizations and fixes introduced in 5.3.1. There is few of them mentioned in the release notes. Lucky for me, I was able to make my tests working by a simple workaround, using few more variables and bindings. But I would prefer to use my original code. Hope they will fix it soon ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

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

Re: CRITICAL: SQL Data connector query not updating correctly

Post by krstcs » Mon Mar 30, 2015 1:36 pm

Yeah, 5.3.0 worked fine.
Shortcuts usually aren't...

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: CRITICAL: SQL Data connector query not updating correctly

Post by Support Team » Mon Mar 30, 2015 2:17 pm

Hi all,

Thank you for reporting this issue.
Unfortunately we were not able to reproduce this issue on our side. It would be great if you could send us a small sample which allows us to analyze the problem directly on our machines.

Thank you for your understanding and your patience.

Regards,
Markus (S)

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

Re: CRITICAL: SQL Data connector query not updating correctly

Post by krstcs » Mon Mar 30, 2015 4:20 pm

Markus, I just sent you an email with a sample solution and DB setup script which will demonstrate the issue. No SUT is needed.
Shortcuts usually aren't...

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: CRITICAL: SQL Data connector query not updating correctly

Post by Support Team » Tue Mar 31, 2015 4:33 pm

Hi all,

Thank you for providing your samples.

Unfortunately, it is necessary to reload the data cache by using the following line of code
DataSources.Get(“DATASOURCENAME”).Load();
Please use this Load() method after modifying or updating the DataSource of your Test Cases.

Thank you for your understanding.

Regards,
Markus (S)

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: CRITICAL: SQL Data connector query not updating correctly

Post by odklizec » Wed Apr 01, 2015 8:36 am

In my case, it was required to call below method in teardown section of affected test cases. I just added a simple code module containing this line:
TestCase.Current.DataContext.ReloadData();
In my opinion, it would be better to keep the old way (automatic reloading of data connectors) and offer an option in settings. If enabled, reload should be used in code where necessary?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

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

Re: CRITICAL: SQL Data connector query not updating correctly

Post by krstcs » Wed Apr 01, 2015 3:17 pm

From my offline discussion, they are going to revert back to automatic reload at the start of each test case as it was previously. However, that won't be done until the next release, at the earliest.

The workaround that Markus posted works for me.
Shortcuts usually aren't...

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: CRITICAL: SQL Data connector query not updating correctly

Post by Support Team » Wed Apr 01, 2015 4:57 pm

First of all, I want to apologize for the inconveniences that change may have caused you.

With 5.3.1 we addressed some memory and performance issues caused by frequently loading (large) data sources. We have intentionally changed the behavior to not load data sources anew for every test case and even expected people, who are changing data sources in code at runtime, to have to adapt their code because of that change.
krstcs wrote:they are going to revert back to automatic reload at the start of each test case as it was previously
This is true, for now (see last paragraph of this post), we are going to revert back to the behavior that data sources are reloaded at the start of each test case, because of the following reasons:
First, we thought that the change would improve performance and memory consumption, but we now realized it only helps in a small number of cases (at least in the way it is currently implemented). So it causes a breaking change and work for a number of people (like you) without providing real value too all customers.
Second, we now also realized that the change has negative effects on future possible improvements regarding memory and performance with respect to data sources. I.e. the change does allow use of data sources in a way that would immediately cause memory leaks we could not fix without breaking changes again.

So, long story short, we tried to greatly improve memory and performance, but went to far with this change. Again, we are sorry for this mistake.

However, even if we now revert the behavior back, I recommend adding the code to reload the data source whenever you change a data source from code while a test suite/test case is running. We may be forced to change the behavior in the future in order to substantially improve performance and memory consumption. Explicitly reloading the data source when you change it in code should guarantee that you have the up-to-date data available.

Regards,
Alex
Ranorex Team

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

Re: CRITICAL: SQL Data connector query not updating correctly

Post by krstcs » Wed Apr 01, 2015 5:56 pm

Alex, thanks for the clarification! I'm already adding that line to my library method that does this.
Shortcuts usually aren't...

Fergal
Certified Professional
Certified Professional
Posts: 455
Joined: Tue Feb 18, 2014 2:14 pm
Location: Co Louth, Ireland
Contact:

Re: CRITICAL: SQL Data connector query not updating correctly

Post by Fergal » Wed Apr 08, 2015 9:32 am

I have test suites which contain Test Cases that use different data sources - Excel spreadsheets and simple data tables. Most modules are recorded modules with only a couple of code modules.
Support Team wrote:...even if we now revert the behavior back, I recommend adding the code to reload the data source whenever you change a data source from code while a test suite/test case is running...
Is this something I need to be concerned about?

Thanks!

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

Re: CRITICAL: SQL Data connector query not updating correctly

Post by krstcs » Wed Apr 08, 2015 4:48 pm

This only applies if you are manipulating the data connector in code. If you are not manipulating the data connector during your tests, then, no, you don't have to do anything.
Shortcuts usually aren't...

Fergal
Certified Professional
Certified Professional
Posts: 455
Joined: Tue Feb 18, 2014 2:14 pm
Location: Co Louth, Ireland
Contact:

Re: CRITICAL: SQL Data connector query not updating correctly

Post by Fergal » Thu Apr 09, 2015 9:30 am

Thanks for the clarification krstcs.

sivakumaran
Posts: 20
Joined: Fri Dec 18, 2015 8:07 am

Re: CRITICAL: SQL Data connector query not updating correctly

Post by sivakumaran » Wed May 04, 2016 11:55 am

Hello,

Even I am experiencing the same problem
My test suite looks like this,
+ParentTestCase - ParentConnector - rows: 2
++SqlCodeModule
+++ ChildTestCase - ChildConnector - rows: 2

My database has two tables
ProjectPath is one table with two columns
ProjectID - Number
ProjectPath - Memo
The ParentConnector binds this table to the ParentTestCase


Another table PnvPath with two columns
ProjectID - Number
PnvPath - Memo

The ChildConnector binds this table to the ChildTestCase

Based on the Parent table's Project ID, a subset of rows must be feeded to the ChildTestCase

Because of that is the SqlCodeModule
which does nothing but, the ChildConnector's query and substituted with a modified query like,
@"SELECT * FROM (OpenEditor) WHERE (ID = id);"
This id comes from the parent testcase data column.

even I tried TestCase.Current.DataContext.ReloadData(), but still the query is not taking effect.

Please help.

regards,
Svia