Automate integration testing
Define test cases
The objective in this chapter is to create a build definition that builds, deploys and runs integration test for all your BizTalk applications.
First define a test case for each test and assign test code to it. Make sure the IntegrationTests solution is open i Visual Studio. Then, on the "Team" menu, select "New Work Item", and then "TestCase".
Give the test case a name, and click on the "Associated Automation" tab.

Click the button with the three dots, and select the test. Later, when the test runs the dll file will be copied to the server where the test agents run and executed there. That is why it was important to embed the test data in the dll. If we had not done that, we would have to take additional steps to deploy test data to the test agents.

Repeat the steps above for each test you want to run.
Open "Microsoft Test Manager 2013" and switch to the "Testing Center".

Click on "Add" to create a new test plan. Then, select the plan you just created.

Click on "Add" to add tests to the test plan.

This is a search query to find the test cases in TFS. If necessary, adjust it to match you project. Click "Run" to find the test cases.

Select the test cases you need, and click "Add test cases".

Now, click "Properties" on the top menu. Then, select the test environment, and in the test settings drop down menu, select "New..."

Give the test settings a name.

Select the servers to run the tests. Previously we defined the BizTalk servers to belong to the "Servers" role.

Use default settings for "Data and Diagnostics" and "Advanced" for now. Change these later as needed.
Save and close the settings.
Create the build definition
First update the "Test" build definition to include the "IntegrationTests" solution.

Then create a new build definition exactly the same was as you did for the automated deployment. Call the build definition Test_Build_Deploy_IntegrationTests.
Also, choose to run tests. Select the test you just defined.

Save the build definition.
For the tests to succeed, BizTalk must obviously be running, and the applications started. Check that you have set the applications to start in the BTDF projects. For the last application that deploys, set "SkipHostInstancesRestart" to false. If you do this for every application, deployment will take a very long time.
Also, make sure the test agent service account has write access to the file share where the test sends the files.
Now, queue an new build, and watch the logs.
When finished, click the "View Test Results" link to open Test Manager, and view the tests.

