The code I've been using is:
Which will reference the bin/Debug folder. I'll then store a TestFiles folder in the project's folder and use general code that moves up two folders in the directory to access the project directory, and then access the TestFiles folder from there (have I lost you yet?).
Code: Select all
So far this has worked very well when running via Ranorex Studio. However...
I have some tests that I run from command line, and the System.IO.Directory.GetCurrentDirectory() code will reference the folder where the .bat file is located, not where the .exe being run is located.
I could go through each test suite and add a condition to check if the current directory is the bin/Debug folder, but I feel like it's a little clunky. Has anyone else reference test files like this and have a more efficient way of doing so?