Replacing connection strings in app.config in test projects
In my web project, AppHarbor successfully replaces my connection string with the connection string to the AppHarbor database, so that's all and well.
However, I also have a test project with integration tests, which is run on every deploy. Unfortunately, AppHarbor doesn't seem to find and replace the connection string in the app.config file for the test project. It has the same name, and generally looks exactly the same as in the web.config file. Does AppHarbor only replace connection strings in web.config in the web project? And if so, any idea how I should work around this?
Discussions are closed to public comments.
If you need help with AppHarbor please
start a new discussion.
Keyboard shortcuts
Generic
| ? | Show this help |
|---|---|
| ESC | Blurs the current field |
Comment Form
| r | Focus the comment reply box |
|---|---|
| ^ + ↩ | Submit the comment |
You can use Command ⌘ instead of Control ^ on Mac
Support Staff 1 Posted by friism on 20 Mar, 2011 07:09 AM
Can I ask which database you would want to use when running unit tests? At any rate, you're not the first user to ask for a database to use when running unit tests. Where wary of adding such a feature, because unit tests really should work on in-memory databases or at least temporary ones.
Some time ago, I created a project that uses a local file-system-based SQL Server CE database for unit testing. Would that work for your use case?
2 Posted by nahojd on 20 Mar, 2011 10:00 PM
I would like to run my integration tests against a database that is as similar as possible to the production database, an SQL Server. Since I run all my integration tests in a transaction scope, that I rollback in the end, I could run them against the production database (I don't have that many tests, and they don't take long to run). So that was what I was trying to do in AppHarbor.
I use Linq to SQL in my application, and while I possibly could make that run against a SQL Server CE database, that somewhat defeats the point of the integration tests, since they won't be testing the actual integration against the database.
One way to make it work without running against the production database would be if you allowed me to create two SQL Server databases in one application, one for testing and one for production. But for now, I guess I'll just put the production database connection string directly into the test config.
Support Staff 3 Posted by friism on 21 Mar, 2011 03:02 AM
OK, cool that you have a workaround. We'll keep your use case in mind,
friism closed this discussion on 21 Mar, 2011 03:02 AM.