0
votes

When I created build definitions with TFS2015 (not XMAL ones) to run my automated test cases, I found I can't rerun failed ones. In MTM I tried to rerun the failed test cases, I can find the build which was created by the new build definition, but I can't find the "Test settings" and "Environment" which are more specified to before TFS2013 using XMAL and lab center to create test agent. As TFS2015 is using machine group.

Thanks a lot.

1

1 Answers

0
votes

You may need to add a PowerShell task in your build definition to write your own script to rerun failed tests. Here is a TFS API for your reference:

 /// <summary>
    /// Reruns failed test cases
    /// </summary>
    /// <param name="run">Test run to process</param>
    /// <returns>Iterable list of test results which were reset</returns>
    public IEnumerable<ITestCaseResult> ReRunFailed(ITestRun run)
    {
        run.Refresh();
        var list = new List<ITestCaseResult>();
        foreach (var result in run.QueryResults().Where(result => result.Outcome == TestOutcome.Failed))
        {
            result.Reset();
            list.Add(result); 
        }
        return list;
    }

Referred article: http://answers.flyppdevportal.com/MVC/Post/Thread/183938a9-cb8b-410a-a47c-278f04e48d90?category=vsmantest