Custom configuration file of the unit tests project on the build (or continuous integration) machine
There are a lot of ways to change the configuration file in a project based on the build type. In my case I need a custom configuration file for CI.
My approach was a little different than the classic one. In general we have debug and release build. We named the configuration file app.debug.config and app.release.config. In this case we need a 3rd file called app.ci.config. How we can use this file on our build.
The most simple solution is to write a PowerShell or bat script that delete the app.config and rename app.ci.config to app.config. This script can be added as a CI step on your server.
Simple like this you can have a custom CI configuration of your unit tests without having to use different tools or create complicated msbuild steps.
My approach was a little different than the classic one. In general we have debug and release build. We named the configuration file app.debug.config and app.release.config. In this case we need a 3rd file called app.ci.config. How we can use this file on our build.
The most simple solution is to write a PowerShell or bat script that delete the app.config and rename app.ci.config to app.config. This script can be added as a CI step on your server.
Simple like this you can have a custom CI configuration of your unit tests without having to use different tools or create complicated msbuild steps.
del /f IntegrationTests\app.config
rename \app.ci.config app.config
An alternative could be XML transformation (http://msdn.microsoft.com/en-us/library/dd465326.aspx).
ReplyDelete