1
votes

We're using TFS Build and are having the TFS Build process run tests through a Test Controller on a Test Agent on a remote machine. We do this via a testsettings file in which we specify the test controller. This testsetting file is specified as an argument in the default TFS 2012 Build process template.

Everything works fine. However, our build takes about an hour. In the event that a test should fail because of an environmental issue (so in the event where it fails only on the test agent and not on our Dev machines), I'd like to be able to re-run the tests and diagnose the environmental issue that happened. However I can't seem to figure out how to do that WITHOUT re-running the entire build. Once the environmental problem is fixed, I'd like to be able to re-run the tests again to make sure everything is ok. I'd like to do all this without re-running the entire build. Ideally when I re-run my tests they should run in as similar a configuration as possible as to when TFS Build runs the tests.

Is there a way to do this? Is using MSTest command line an option to re-run the tests? If so, how do I know which arguments to pass to it? Ideally i'd want the same arguments TFS passed to the QTAgent process which ran the tests?

4

4 Answers

1
votes

Create build specific, based on sequential workflow specific whose you delete from designer WWF all activities that don't need.

I suggest theses steps : 1. Select link 'Create Build Definition' 2.Create Process Template by copy pasting on Source Control, 3.Open your copied Workflow on designer 4.Delete all activities that you don't need. 5.Finish by associating this workflow to build definition (Select Process Tab)

0
votes

The easiest way to prevent the whole build from running is to set "Clean Workspace" to None.

That means if you want to re-run the tests you can just queue the existing build definition manually, change to the Parameters tab and set Clean Workspace to None before click the "Queue" button.

enter image description here

In this case existing build outputs remain as well as source code files that have not changed since the most recent build (by performing a tf get without the /all switch).

It's probably not exactly what you want because if there were some check-ins since the most recent build the changed source files will be fetched and built.
But if it is not important for you to re-run the tests using exactly the same build output each time it could be a good solution for you since it usually reduces build time significantly.

0
votes

One way for you to possibly do this is:

  1. Open the build that had failed tests in Visual Studio
  2. Scroll down to the test runs section.
  3. Click on the failed test run. The Test Results window should open.
  4. Select the failed tests you want to rerun.
  5. click the "Run checked tests" button
0
votes

Supposedly this should work: vstest to tfs logger. I can verify that the test are run and published to our tfs, but I could not see the test result on the tfs build page only using the link that is produced (the one with mtm as protocol)