Best Practice with Open File Dialog and "TestFixture" Files

Ranorex Spy, Recorder, and Studio.
User avatar
boxblinkracer
Posts: 4
Joined: Fri Aug 02, 2019 2:15 pm
Contact:

Best Practice with Open File Dialog and "TestFixture" Files

Post by boxblinkracer » Mon Aug 26, 2019 6:29 pm

Hi guys

I was wondering if you have any best practices for this use case:

"I have some features that allow the user to load custom files...then that custom file is visible in a grid or anywhere else."


So now i'm wondering how to get a stable test that selects that custom file in an OpenFileDialog (WinForms) and then validates that is has been loaded and is ready (....whatever that might be...)

where should i locate that testing file? if its inside the ranorex project in a "test fixture" folder, then i have dependencies to the folder location of the project (i obviously cannot use a relative path in an end user open file dialog....)
or do you recommend using a setup function to copy that file to the Desktop and open it from there?

my goal is to have some built-in test fixture files and to avoid anything that can change on dev-environments such as the ranorex-project-folder....


any ideas and best practices are appreciated


thank you
Christian

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

Re: Best Practice with Open File Dialog and "TestFixture" Files

Post by odklizec » Mon Aug 26, 2019 6:40 pm

Hi,

What I’m doing in my projects, is storing test files in ‘Data’ folder, which content is automatically copied (during build) to bin/release(debug) folder. Then I’m using TestSuite.WorkingDirectory method, which returns path to bin/release(debug) folder, form which I’m pointing to ‘Data’ folder. This approach assures that the “external” files are always found, regardless of Ranorex Studio or test suite location. These posts should provide you with more details...
https://www.ranorex.com/forum/add-file- ... tml#p52728
https://www.ranorex.com/forum/how-to-se ... tml#p42093
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

User avatar
Stub
Posts: 266
Joined: Fri Jul 15, 2016 1:35 pm

Re: Best Practice with Open File Dialog and "TestFixture" Files

Post by Stub » Tue Aug 27, 2019 8:14 am

For our testing I make up the file path to the location of a test data file. I start from the location of the binary test .EXE in the bin/release folder since I have our output binaries setup to go to a specific location. Using that I can then build up a path to our data folder, under which all the data files are hierarchically stored. I then slap that path into the Open File Dialog or wherever it's required.

Seems to work well for us so far, though we're not using the Remote Agent thingy. Instead I fetch our Ranorex test solution from source control, build it with MSBuild, and run the test .EXE with suitable command-line parameters.

User avatar
boxblinkracer
Posts: 4
Joined: Fri Aug 02, 2019 2:15 pm
Contact:

Re: Best Practice with Open File Dialog and "TestFixture" Files

Post by boxblinkracer » Tue Aug 27, 2019 9:18 am

Hi

thank you
exactly what i was looking for :)

i think i go with the combination of both of you.
so adding the files as resource, and then also "slapping" the current path in the open file dialog....that is indeed the most convenient and realistic way.

question answered :)

thanks
Christian