Reputation: 168
I am currently using:
The current project is an N-tier MVC application with an MVC Test project. The application runs on the Azure VM (in the cloud), but is accessible locally by being part of the company domain. I have created some unit tests that test the controller actions and they are passing locally. When I check-in and build the project with VSO, the unit test(s) fails with the following error:
Test method Enrollment.StudentEnrollment.Tests.Controllers.HomeControllerTest.SearchWithNoTermOrFilterDefaultSort threw exception: System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
I am assuming that this error has to do with VSO not being able to access the VM due to being on a different domain, but could use some help in how to fix the issue. I would like to be able to run my unit test with the build through VSO/TFS.
I am hoping that someone on here has a little more experience than I do with this process and can help me with connecting VSO to the remote server/remote SQL server.
Some ideas that I have, but I am unsure on how to proceed with them at this time:
Other ideas:
Thanks
Upvotes: 0
Views: 385
Reputation: 23444
Your unit tests should be able to run without access to an instance of your application. Otherwise It is not a unit test.
If you want to fun integration tests then you should avoid doing so during a build. There are tools that are part of visual studio ALM (Microsoft Test Manager) platform to handle that. Look to lab management standard environments.
If you really need to do this for now then you can fun your own local build server attached to VSO. That local build server would be on your network and would have access to the server in question.
Upvotes: 1