Automated Build-Deploy-Test using TFS 2012
Editor’s note: The following post was written by Visual Studio ALM MVP Anuj Chaudhary
Overview
The automated build, deploy and test mechanism in TFS 2012 provides the ability to perform automated build, deploy and test on demand. A daily build could be scheduled which builds the latest code, deploys it to an environment and runs the tests on it. The build can be scheduled to run on a daily basis or on every check in to make sure that we test often and test early.
If you are familiar with the Automated Build-Deploy-Test workflow in TFS 2010, you had to use a dedicated SCVMM which was assigned to a Team Project Collection. To know more, please refer https://blogs.msdn.com/b/mvpawardprogram/archive/2011/10/17/automated-build-deploy-test-using-tfs-2010.aspx
You can create the same environment in TFS 2012 which is called “SCVMM Environment”
However, with TFS 2012 a new category of Lab Environment is introduced called "Standard Environment".
Unlike TFS 2010, with Standard Environment you don’t need to have your VM's configured with a specific SCVMM to run Build-Deploy-Test workflow. You can deploy builds on this environment and run tests on it. However, you cannot remotely start, stop or take snapshots of this environment.
Also unlike TFS 2010, you don’t need 3 different agents to be installed on the machines in the environment. You can just install the test agent on the machines or it will be installed for you as part of creating the environment.
Standard Environment Architecture
The architecture comprises of the components listed below.
Team Foundation Server
Team Foundation Server (TFS) provides the team the capability to coordinate and integrate their efforts. It provides the following:
-
- Source control mechanism
-
- Creating work items (User Story, Feature, Test case, Bug, etc.)
-
- Build, Deployment and Test mechanism
-
- Reporting mechanism
-
- SharePoint Integration
Build Controller
It is a background process that manages a set of build agents.
Build Agent
It is a background process that receives build commands, runs the build and reports the results. Multiple build agents are managed by a build controller.
Test Controller
It is a background process that manages a set of machines which have the test agents installed.
Test Agent
It is a background process that receives test run commands, runs the tests and reports the results. Multiple test agents are managed by a test controller.
Test Manager
Test Manager is used to create test plans, tests suites, assign test cases and run tests. Multiple test runs can be managed and analyzed in the Test Manager.
Lab Manager
Lab Manager is used to create and manage environments. These environments are used to deploy build and run tests.
Standard Environment Workflow
The below diagram describes the step by step process to automate the Build-Deploy-Test workflow using TFS 2010.
Build-Deploy-Test Workflow Output
The below figure shows the output of the Build-Deploy-Test workflow
Conclusion
TFS 2012 Build-Deploy-Test mechanism provides the ability to build, deploy and test each and every build in an automated fashion to make sure that regressions are caught in time. Due to the integrated Reporting capability, the management team is always aware of the current status of the product. Thus the team achieves the goal of rapid delivery along with maintaining the quality of the product.
Primarily focused on Software Testing and Automation. Extensive working experience on Manual testing, Automated testing, Performance testing and White Box testing. Contributing in Visual Studio ALM community and specifically in testing areas which involve Visual Studio Unit tests, Web tests, Load tests, Coded UI, MTM and Lab Management.
Comments
Anonymous
April 29, 2013
I am quite new in Team Foundation Server 2012, recently i encounter error when trying to using Visual Studio 2012 and create New Build Definition and build the project. The error message " TF215097: An error occurred while initializing a build for build definition Persify-TestingCI - HelloWorld: Exception Message: TF30063: You are not authorized to access Microsoft-IIS/8.0. (type TeamFoundationServerUnauthorizedException) Exception Stack Trace: at Microsoft.TeamFoundation.VersionControl.Client.UploadDownload.EndGetDownloadStream(IAsyncResult asyncResult) at Microsoft.TeamFoundation.Build.Client.ProcessTemplate.Download(String sourceGetVersion) at Microsoft.TeamFoundation.Build.Hosting.BuildControllerWorkflowManager.PrepareRequestForBuild(WorkflowManagerActivity activity, IBuildDetail build, WorkflowRequest request, IDictionary`2 dataContext) at Microsoft.TeamFoundation.Build.Hosting.BuildWorkflowManager.TryStartWorkflow(WorkflowRequest request, WorkflowManagerActivity activity, BuildWorkflowInstance& workflowInstance, Exception& error, Boolean& syncLockTaken) " Any idea?Anonymous
March 26, 2014
I have a doubt. If my TFS is the 2012 SP2 version and I'm configuring a Test Controller of Agents for Visual Studio 2013, could be a problem there?!... Or it doesn't matter? Thank you.Anonymous
June 10, 2014
Does Build Deploy Test Workflow work as is with TFS 2013 ??Anonymous
December 29, 2016
i am not understood how it build automatically? i have configure erverything but no use. do i need any powershell command to build automatically? if yes. where i have to?