Newly dynamically added data row not executed

Ranorex Spy, Recorder, and Studio.
qwertz
Posts: 9
Joined: Sun Sep 30, 2018 7:07 pm

Newly dynamically added data row not executed

Post by qwertz » Sun Sep 30, 2018 7:31 pm

Hi,

I'm new to Ranorex Automation and still learning how to implement things. I managed to add a column to my data source (SimpleDataConnector) in a code module and use the values in that column. I also managed to add a data row to my data source but that row is not used for the variable iteration:
I have a column called 'Browser' in which I have the variables for the browsers I want to run the test cases on. In that column I have 2 browsers (rows) initially and I add one in a code module during SETUP of the test case. But the test case still is only excuted for the first two browsers but not the third:
Testcase:
--SETUP:
--Init -> Third browser is added
-----------
OpenBrowserModule : -> only excuted with the first two browsers

How can I make the test case also be executed with the third browser?

Thanks in advance,
U
---
Ranorex Studio 8.2 on Windows 10
Last edited by qwertz on Thu Oct 04, 2018 10:08 am, edited 1 time in total.

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

Re: Newly dynamically added data row not exeuted

Post by odklizec » Mon Oct 01, 2018 7:39 am

Hi,

How exactly have you added the third row? By code? In this case, please post entire code you are using. Where exactly have you applied your code? It must be applied BEFORE the testcase/smartfolder, with given data connector.

BTW, is there a reason why you are adding another browser by code? Why don't you simply add all browsers before executing test? And if needed, limit the number of browsers used by test, by changing the data range. It's much more safe and error proof, than dynamically adding data to the data connector.
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

qwertz
Posts: 9
Joined: Sun Sep 30, 2018 7:07 pm

Re: Newly dynamically added data row not exeuted

Post by qwertz » Tue Oct 02, 2018 7:19 am

Hi Pavel,

thank you for your reply.
odklizec wrote:
Mon Oct 01, 2018 7:39 am
How exactly have you added the third row? By code? In this case, please post entire code you are using. Where exactly have you applied your code? It must be applied BEFORE the testcase/smartfolder, with given data connector.
I will try that and give you feedback.
odklizec wrote:
Mon Oct 01, 2018 7:39 am
BTW, is there a reason why you are adding another browser by code? Why don't you simply add all browsers before executing test? And if needed, limit the number of browsers used by test, by changing the data range. It's much more safe and error proof, than dynamically adding data to the data connector.
I do it this way because it depends on an external source which browser I want to execute the tests with. I actually have all browsers in the data source and depending on the external source I add the URL to open the browser with in the column I added by code. If the external source does not have one of the browsers I skip it for the test and if there is a browser with multiple different URLs I add another row with that browser and the other URL. I hope this was understandable.
BUT: can you tell me how to set the range for the data connector? Is it with the method Ranorex.Core.Data.DataContext.SetRange()? I tried that method before but it probably had no effect because I did that inside the container with the data source I wanted to change.
But how would I set a range with a gap somewhere in the middle like '0-2 and 4-5'?

Thanks again!
U

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

Re: Newly dynamically added data row not exeuted

Post by odklizec » Tue Oct 02, 2018 7:28 am

Hi,

This post should provide you with details, how to programmatically change the data source range...
data-source-choose-data-range-programat ... tml#p44946
The code must be called BEFORE the test case/smart folder with affected data connector. Hope this helps?
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

qwertz
Posts: 9
Joined: Sun Sep 30, 2018 7:07 pm

Re: Newly dynamically added data row not executed

Post by qwertz » Thu Oct 04, 2018 10:32 am

Hey Pavel,

I was now able to try out your solution and it worked just fine. I manipulate the data source before I use it and it works just fine! Thank you so mich for your help!

For anyone having the same trouble here is how I do it:
Testcase:
[SETUP]
Init-Module --> here I manipulate the data source
SmartFolder --> Data source with browsers
OpenBrowser-Module

I manipulate the data source using the method

Code: Select all

DataSources.Get("<data source name>")
and don't forget to call the Store()-Method after the manipulations.

As I did not find a way to set more than one range for a data context and therefore be able to skip a browser 'in the middle' of my data source (e.g. browser no. 2 of 4), I set the error behavior of the smart folder the data source is bound to to 'continue with iteration' and throw an exception when the browser to be skipped is used (in the iteration).

Regards,
U