Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Azure by (5.8k points)

I'm enjoying the new Build tool in Visual Studio Online. It allows me to do almost everything that I do my local build server. But one thing that I'm missing is integration database tests: for every build run, I re-create test database from scripts and run DB-tests against it.

In Visual Studio Online I can't seem to find any database instance available for my needs.

I have tried creating an Azure SQL database (via PowerShell) for every build run and then delete it after the build is complete. But it takes forever (comparing to the rest of the build process) to create a database. And even when PowerShell scripts are done, database is not yet ready to accept requests - I need to constantly check if it is actually ready. So this scenario becomes too complex and not reliable.

Are there other options to do a database (SQL Server) integration tests in Visual Studio Online?

Update: I think I'm not very clear of what I need - I need a free (very cheap) SQL Server instance to connect to that runs on build agent in VSO. Something like SQL Express or SQL CE or LocalDB, where I can connect to and re-create database to run C# tests against. Re-creating database or running tests is not a problem, having a valid connection string is a problem.

1 Answer

0 votes
by (9.6k points)

Put the following in your solution's post-build event to create a MYTESTDB LocalDB instance. This will allow you to connect to (LocalDB)\MYTESTDB and run the database integration tests.

"C:\Program Files\Microsoft SQL Server\120\Tools\Binn\SqlLocalDB.exe" create "MYTESTDB" 12.0 -s

Related questions

Browse Categories

...