SQL Class as Datasource (Instead of SQL Connector)

Best practices, code snippets for common functionality, examples, and guidelines.
sdrx
Posts: 19
Joined: Tue Jan 29, 2019 10:15 am

SQL Class as Datasource (Instead of SQL Connector)

Post by sdrx » Wed May 20, 2020 9:52 am

Hello there. Our solution is currently split between some users using a code module and some users using SQL data connectors.

The code module basically queries the database with a basic query, such as "select fullname from table1 where uniqueid = xyz" to return 1x user and validates a result before moving on to the next step.

The SQL data connector will do something along the lines of "select fullname from table1 where firstname like %a%" which will return multiple results and then pass each one in to the test suite as a new item to iteratively evaluate against.

If it possible to have the iterative functionality of an SQL data connector using each item as a variable, in the form of a SQL code module instead?

sdrx
Posts: 19
Joined: Tue Jan 29, 2019 10:15 am

Re: SQL Class as Datasource (Instead of SQL Connector)

Post by sdrx » Thu May 28, 2020 10:24 am

Is this possible at all?

sdrx
Posts: 19
Joined: Tue Jan 29, 2019 10:15 am

Re: SQL Class as Datasource (Instead of SQL Connector)

Post by sdrx » Wed Jun 03, 2020 8:57 am

Does anyone at Ranorex read these forums?

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

Re: SQL Class as Datasource (Instead of SQL Connector)

Post by odklizec » Wed Jun 03, 2020 9:13 am

Hi,

Yes, Ranorex folks read and answer this forum, but some posts sometime slip from their radars ;) Your best chance, and preferred way of communication, is their support form, available here:
https://www.ranorex.com/support-query/
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

Vega
Posts: 222
Joined: Tue Jan 17, 2023 7:50 pm

Re: SQL Class as Datasource (Instead of SQL Connector)

Post by Vega » Thu Jun 04, 2020 9:59 pm

Based on what you are trying to achieve, I believe it would be much easier to just adjust the existing data connector on the current test container via API rather than try to manage the entire test suite via your code. Here is a small code example of adjusting your query during runtime:

Code: Select all

DataCache dc = DataSources.Get(dataSource);
((SqlDataConnector) dc.Connector).Query = newQueryString; 
dc.Load();
I have also included a link to the Ranorex API below:
Please let me know if this will not work for you and I will try to suggest an alternative.

hope this helps