create excel connector and do data binding from code.

Class library usage, coding and language questions.
siddhantsudan
Posts: 4
Joined: Thu Jul 07, 2016 12:51 pm

create excel connector and do data binding from code.

Post by siddhantsudan » Fri Jul 08, 2016 4:26 am

Hi,

I wanted to know whether it is possible to specify the excel file path in data driven testing at runtime or in code. Currently I have created a data connector and I am using the test suite's "manage data sources" to specify the file name.The problem is that I will have multiple excel files with different data but same column names and on the basis of the username of the user who is running ranorex I will have to pick the corresponding excel file (name of excel is the username).Thanks in advance.

jma
Posts: 111
Joined: Fri Jul 03, 2015 9:18 am

Re: create excel connector and do data binding from code.

Post by jma » Mon Jul 11, 2016 10:09 am

Hi,

a similar topic was already discussed in the following forum thread: http://www.ranorex.com/forum/multiple-d ... tml#p31720

You could create different data sources for each excel file and set the data source of the test case accordingly. Note that this information needs to be updated before the corresponding test case is executed.

Hope that helps!

siddhantsudan
Posts: 4
Joined: Thu Jul 07, 2016 12:51 pm

Re: create excel connector and do data binding from code.

Post by siddhantsudan » Fri Jul 15, 2016 8:36 am

jma wrote:Hi,

a similar topic was already discussed in the following forum thread: multiple-data-source-in-one-test-case-or-use-ancestor-s-t7838.html#p31720

You could create different data sources for each excel file and set the data source of the test case accordingly. Note that this information needs to be updated before the corresponding test case is executed.

Hope that helps!
I do not want to create excel connectors in ranorex studio and then choose one of them in code.I want to create one connector but I just want the excel file path for that connector to change at runtime(using code).This should not change the data binding .The problem with creating multiple connectors is that I would have to create a new connector each time a new user wants to use the solution because the file for the user would be at a different location.

jma
Posts: 111
Joined: Fri Jul 03, 2015 9:18 am

Re: create excel connector and do data binding from code.

Post by jma » Mon Jul 18, 2016 12:01 pm

I'm afraid there is no way to update the path of the data connector during runtime. In this case, I would suggest specifying the same path/file name for each data source (for example, C:\TestData\test.xlsx). Before the test is executed, you will need to deploy the correct test data (according to the user) to that file location. For example, the user specific file user.xlsx will be copied to test.xlsx.