Skip to content

Instantly share code, notes, and snippets.

@bzbetty
Last active December 13, 2015 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bzbetty/4959374 to your computer and use it in GitHub Desktop.
Save bzbetty/4959374 to your computer and use it in GitHub Desktop.
<TestManagementPluginSection>
<Plugins>
<Plugin classname="Enlighten.TFS.TestManagement.Controller.AgentFilter.AgentFilterPlugin, Enlighten.TFS.TestManagement.Controller.AgentFilter"/>
</Plugins>
</TestManagementPluginSection>
using Microsoft.TeamFoundation.TestManagement.Controller;
using Microsoft.VisualStudio.TestTools.Common;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Serialization;
namespace Enlighten.TFS.TestManagement.Controller.AgentFilter
{
public class AgentFilterPlugin : TcmRunControllerPlugin
{
public override void Initialize(Microsoft.TeamFoundation.TestManagement.Client.ITestRun run, Microsoft.VisualStudio.TestTools.Common.TestRunConfiguration runConfig)
{
var testConfigurationIds = run.QueryResults().Select(r => r.TestConfigurationId).Distinct();
foreach (var testConfigurationId in testConfigurationIds)
{
var config = run.Project.TestConfigurations.Find(testConfigurationId);
foreach (var key in config.Values.Keys)
{
if (!runConfig.AgentProperties.ContainsKey(key))
{
runConfig.AgentProperties[key] = config.Values[key];
}
else
{
runConfig.AgentProperties[key] += "," + config.Values[key];
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment