MSTest Command Line Settings

冷暖自知 提交于 2019-12-06 11:35:45

I use an app.config file in my test project to configure my tests. Source control contains the app.config used in TeamCity to run the tests.

On compilation the app.config is copied to the bin folder and renamed to [assembly-name].config. You can then access any settings in the .config file from your test code through the ConfigurationManager.

On development systems, the .config file is customized to run tests against what ever local test server the developer is using.

I find this the cleanest approach yet, because it records how tests are configured in source control.

If you need more flexibility you could setup an additional build step in TeamCity to modify the .config file as needed using some XML transforms or string replacements from a custom MSBuild script.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!