Data source files organization and maintenance

Ranorex Spy, Recorder, and Studio.
lyn5000
Posts: 50
Joined: Mon Feb 13, 2012 5:52 pm

Data source files organization and maintenance

Post by lyn5000 » Wed Jun 20, 2012 9:01 pm

1. Open the .rxtst and click Manage Data Sources
2. For all data sources (mine are .xlsx files that exists in various test case source folders within the solution to use for data-driven test cases) check "Include file in test suite". These files are then copied to the same folder as my rxtst solution file (call it the "solution root folder").
3. rebuild solution and the .xlsx files are deployed from the "solution root folder" to bin/Debug.

It becomes a little disorganized in the "solution root folder" because every .xlsx file from many tests get copied to this folder and we have to leave these copies there and then check them into our source control so that when the solution builds they get copied to bin/Debug.

So in the solution we end up with the original xlsx files in the various test case folders and copies of all of these files in the "solution root folder" which can be confusing when it comes to updating the xlsx files because if you update the "solution root folder" xlsx file the original xlsx file in the test case folder is different and if you udpate the original xlsx file in the test case folder the "solution root folder" xlsx file does not get updated to reflect the change (even after cleaning and rebuilding) so bin/debug ends up with the older version of the xlsx from the "solution root folder" and not the update you made in the test case folder.

So since only the "solution root folder" xlsx files get deployed to bin/debug, there seems no point in having the xlsx files in the original test case source folders but then if all the data source xlsx files exist in the "solution root folder" instead with all the other files in there it becomes a bit disorganized.

Is this a known issue and is there a way to store the data source files somewhere other than the "solution root folder" and have them deployed to bin/debug and not a copy deployed instead so we don't have to maintain the original and the copy?

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

Re: Data source files organization and maintenance

Post by Support Team » Fri Jun 22, 2012 2:21 pm

Hello,

If you select the check box "Include File in Test Suite" you can include the selected Excel file to your test suite. In every run after you did this Ranorex will use only the Excel file in the project folder and will forget the Excel file outside the project folder. If you change the original Excel file, the changes will be ignored by Ranorex.

As workaround you can try to create a folder in your Ranorex Project e.g. ExcelFiles.
Then copy the excel files you need for the tests into this folder.
Select Add -> Existing Item ... on the folder you created and add the excel files to the project.
Now go to Manage Data Sources and select the Excel file for the specific data connector. Please change the absolute path in the text box "File Name" to a relative path.
E.g. from C:\Users\user\Documents\Ranorex\RanorexStudio Projects\ManagDataSources\ManagDataSources\bin\Debug\ExcelFiles to ExcelFiles\test.xlsx
Deselect the checkbox "Include File in Test Suite".
To make sure that the excel file will be copied into the bin/Debug folder you have to open the properties from the excel file you added and set the property "Copy to output directory" to "Always".
Now you can use this folder for your source control.


Regards,
Bernhard
Ranorex Support Team
.
Image

Styris
Posts: 49
Joined: Tue Feb 03, 2015 2:32 am

Re: Data source files organization and maintenance

Post by Styris » Tue Mar 24, 2015 8:46 pm

This is a 3 year-old post. Can someone please refresh the steps needed to copy the excel files to the output folder (and which folder exactly - just saying Project folder does not help).

Also please let me know that that will take care of any changes that will be made to the excel files along the way.

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

Re: Data source files organization and maintenance

Post by odklizec » Wed Mar 25, 2015 8:28 am

Hi,

Despite the age of the original post and support reply, the steps mentioned by Bernhard are still valid in latest Ranorex 5.x. By Project folder he means the directory where is saved your Ranorex project. But it's completely up to you where you save the data connector file. But considering you will most likely want to store the data connector along with the Ranorex project in source control system, using Ranorex Project folder sounds like a reasonable idea.

Just create a new directory here, called for example "Data" (or whatever you want) and save your data connector files here.
Then open your ranorex project and in Project view enable "Show all files" button...
ProjectsView.png
ProjectsView.png (50.07 KiB) Viewed 3854 times
After that, you should see the Data directory in the project tree, but by default, it will be marked with dotted border and white color, which means the folder and its content is not included in the project yet.

Now right click the data connector file in Data folder and from the appeared menu select "Include in Project". This will make the data connector included in project.

Now select the Data connector file in Projects view and in Properties >> Copy to output dir. select Always, which means the data connector will be copied to output (bin) dir with each project build.
CopyToOutput.png
CopyToOutput.png (49.57 KiB) Viewed 3854 times
Finally, you need to set the Relative path in Manage Data Sources dialog and uncheck "Include File in Test Suite"...
SetRelPath.png
SetRelPath.png (84.72 KiB) Viewed 3854 times
Assuming the "Data" directory is created in project directory and data connector is set to be always copied to output folder, the relative path should be like on the above screenshot Data\yourfilename.xlsx.

That's it. Hope this helps you?
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

bikash06
Posts: 1
Joined: Fri Jul 29, 2016 10:11 am

Re: Data source files organization and maintenance

Post by bikash06 » Mon Aug 01, 2016 1:19 pm

Is this "Include file in test suite" option there with Ranorex 6.

I am not able to add my Ranorex data container file to the project. Could you please explain this with a snapshot if possible.

Martin
Posts: 152
Joined: Fri Aug 15, 2014 12:24 pm

Re: Data source files organization and maintenance

Post by Martin » Mon Aug 01, 2016 2:13 pm

Hey bikash06

odklizec probably has just had a typo and what is ment with "uncheck "Include File in Test Suite"" is unchecking the "Copy File to Project" checkbox. (As the screenshot displays).

Flow is still the same with Ranorex 6.0

And just for further information - snapshot and screenshot are not the same things. You can read about the snapshot from this page: http://www.ranorex.com/support/user-gui ... files.html

There will be times where support staff (or another member) will ask you for a snapshot when you reach a problem or an issue. So it's always good to know the difference and how to create a snapshot.

Martin