I have a project with unit tests in TFS 2010. My unit test need to connect to database, so it has to keep connection string somewhere. This connection string is not needed for main application, it is only used by Unit Test project. I am currently storing this connection string in app.config file of unit test project. So, any developer with access to source code can view database login and password, which is not good for security. Is there a way to store this connection string somewhere in TFS, so that it is not exposed to everyone, but unit test project can still use it?
Asked
Active
Viewed 181 times
1
-
1A database connection string wouldn't be used in a unit test. Be aware of the difference between unit tests and integration tests! – Daniel Mann Feb 19 '15 at 17:30
1 Answers
1
Connection to production database from unit tests is not the best approach. You should have test database with the same schema. What's the best strategy for unit-testing database-driven applications?
Having connection string outside the code can not hide user and password. Developer can still debug unit tests and see connection string.

Community
- 1
- 1

mats.nowak
- 329
- 1
- 7