简体   繁体   中英

How to pass database connection sting to NUnit runner on TeamCity?

I have a TeamCity with 3 agents, and more that 20 configurations for different branches.
Simultaneously on TeamCity runs multiple builds what use same 2-3 databases for unit tests. But in each branches this databases has a differences: new table, columns, etc.

In Db project in c# i have recreate database option. I think errors occurs because database hardcoded in app.config of test project and when new build runs its recreate database.
So how i see that solution is create database for each configuratons and runs tests on it.
How can i pass connections string to unit tests runner, and if possible autogenerate it?

Also i got a little sugegstion that error occurs couse *.edmx files what generated on agents and never removes.

Any advice?

You can use build parameters for specifying the connection string.

As about the possibility to generate a connection string, you can do it with pre-defined parameters (eg, take a build configuration name from it or project name).

Didn't you think about using docker for databases?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM