2
votes

As I'm using Selenium/MSTest for UI tests, I got a problem: I need to deploy an ASP.NET site to a staging server just before the automated tests are executed during a TFS build (TFS 2012).

Although I thought I could do this configuration in the TFS Build process template (DefaultTemplate.xaml), I can't figure out how to change the order to execute a Build->Deploy->Test flow.

Note I've found some how-tos aiding in this goal when using TFS Lab Environment, but this isn't my case.

3

3 Answers

1
votes

Default Template Unit Testing is different from UI Testing. Default template is designed to run Build -> Unit Test -> Deploy.

You are now in Build -> unit Test -> Deploy -> UI Test.

For UI Testing, You need separate Test Agent and set up build agent in interactive process.

These links may help

1
votes

Finally I've solved the problem chaining builds.

For example, when I queue a production build, this is the sequence:

  1. Build, deploy to staging without UI tests
  2. Build, no deploy, staging UI tests only
  3. Build, deploy to production without UI tests
  4. Build, no deploy, production UI tests only

I got the solution from this blog post:

Post's author posted the modified DefaultTemplate.xaml (build definition) in GitHub Gist:

Credits for the whole blogger!

0
votes

One simple solution is to have an intermediate msbuild project file that is specified in your build definition and from there, call the actual solution file.

You can then do whatever is required pre- or post- build to ensure that the environment is up and running prior to TFS executing the tests. We do things like compile and deploy databases prior to TFS running our integration tests.

This is one solution that avoids having to manipulate the build template.