vendredi 29 mai 2015

Visual Studio Online: How to create a build definition with MVC Unit Testing that accesses a remote server?

I am currently using:

  • Visual Studio 2013 for development
  • Visual Studio Online for builds/testing
  • MS Build
  • An Azure VM to house an MVC web app and SQL database

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:

  • A different connection string format: current data source = vm20150201\apps
  • An MSBuild definition command or setting that I am unaware of?
  • An azure setting to connect the VM and VSO Online site to the the same domain

Thanks

Aucun commentaire:

Enregistrer un commentaire