today i set up a new ms build project in jenkins which contains unit tests and integration tests. Before i moved the project to jenkins, i used my local machine to run the tests (Nunit, Reshaper).
Some of my integration tests uses databases to test some logic and i configured the database file location as a static property that is used in my tests to establish a database connection.
As you can imagine this was a little problem when i moved the project to jenkins, because i did not have the database files at the same location.
To solve the problem right now i changed some SetUp() methods in my integration tests. They load a folder from a textfile and this folder points to a resource path where all my needed files are stored. Now i can run the tests on jenkins and my local machine.
I have a bad feeling about this, it feels not correct some how. What would you do to solve my problem? Mocking the files is no solution, i want to interact with the files.
Thank you!
Generally, I think, it is not a good idea to take anything from files during running unit tests. Especially it is not a good idea to take anything from txt/xml/etc files which, as you suppose, will be copied to
debugfolder. Different unit test engines behave differently, some of them haveshadow copyoption and some of them might have this option switched on by default.Shadow copywill make it almost impossible to locate non-dll files in originalDebugfolder.I would recommend embedding all the data you need into the test assembly. Two ways to do it: