Last active
December 13, 2015 18:58
-
-
Save bzbetty/4959374 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<TestManagementPluginSection> | |
<Plugins> | |
<Plugin classname="Enlighten.TFS.TestManagement.Controller.AgentFilter.AgentFilterPlugin, Enlighten.TFS.TestManagement.Controller.AgentFilter"/> | |
</Plugins> | |
</TestManagementPluginSection> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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