diff --git a/Manager/TFSBuildManager.Views/ExportedAgileTestPlatformSpec.cs b/Manager/TFSBuildManager.Views/ExportedAgileTestPlatformSpec.cs new file mode 100644 index 0000000..c06089c --- /dev/null +++ b/Manager/TFSBuildManager.Views/ExportedAgileTestPlatformSpec.cs @@ -0,0 +1,25 @@ +//----------------------------------------------------------------------- +// (c) https://github.com/tfsbuildextensions/BuildManager. This source is subject to the Microsoft Permissive License. See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx. All other rights reserved. +//----------------------------------------------------------------------- +namespace TfsBuildManager.Views +{ + using Microsoft.TeamFoundation.Build.Client; + using Microsoft.TeamFoundation.Build.Workflow.Activities; + + public class ExportedAgileTestPlatformSpec + { + public bool FailBuildOnFailure { get; set; } + + public string RunName { get; set; } + + public string AssemblyFileSpec { get; set; } + + public ExecutionPlatformType ExecutionPlatform { get; set; } + + public string RunSettingsFileName { get; set; } + + public RunSettingsType TypeRunSettings { get; set; } + + public string TestCaseFilter { get; set; } + } +} diff --git a/Manager/TFSBuildManager.Views/ExportedBuildDefinition.cs b/Manager/TFSBuildManager.Views/ExportedBuildDefinition.cs index 6cf4edf..50daa87 100644 --- a/Manager/TFSBuildManager.Views/ExportedBuildDefinition.cs +++ b/Manager/TFSBuildManager.Views/ExportedBuildDefinition.cs @@ -27,6 +27,8 @@ public ExportedBuildDefinition() public string BuildController { get; set; } + public List AgileTestSpecs { get; set; } + public StringList ProjectsToBuild { get; set; } public PlatformConfigurationList ConfigurationsToBuild { get; set; } diff --git a/Manager/TFSBuildManager.Views/ImportBuildDefinitions.xaml.cs b/Manager/TFSBuildManager.Views/ImportBuildDefinitions.xaml.cs index 32a0ff2..0ab9694 100644 --- a/Manager/TFSBuildManager.Views/ImportBuildDefinitions.xaml.cs +++ b/Manager/TFSBuildManager.Views/ImportBuildDefinitions.xaml.cs @@ -129,7 +129,7 @@ private void ButtonImport_OnClick(object sender, RoutedEventArgs e) foreach (var param in exdef.ProcessParameters) { - if (param.Key != "AgentSettings" && param.Key != "BuildSettings") + if (param.Key != "AgentSettings" && param.Key != "BuildSettings" && param.Key != "TestSpecs") { Newtonsoft.Json.Linq.JArray arrayItem = param.Value as Newtonsoft.Json.Linq.JArray; if (arrayItem == null) @@ -183,6 +183,26 @@ private void ButtonImport_OnClick(object sender, RoutedEventArgs e) process.Add("AgentSettings", exdef.GitAgentSettings); } + if (exdef.AgileTestSpecs != null) + { + TestSpecList tsl = new TestSpecList(); + foreach (var aitem in exdef.AgileTestSpecs) + { + AgileTestPlatformSpec agileSpec = new AgileTestPlatformSpec(); + agileSpec.AssemblyFileSpec = aitem.AssemblyFileSpec; + agileSpec.ExecutionPlatform = aitem.ExecutionPlatform; + agileSpec.FailBuildOnFailure = aitem.FailBuildOnFailure; + agileSpec.RunName = aitem.RunName; + agileSpec.TestCaseFilter = aitem.TestCaseFilter; + agileSpec.RunSettingsForTestRun = new RunSettings(); + agileSpec.RunSettingsForTestRun.ServerRunSettingsFile = aitem.RunSettingsFileName; + agileSpec.RunSettingsForTestRun.TypeRunSettings = aitem.TypeRunSettings; + tsl.Add(agileSpec); + } + + process.Add("TestSpecs", tsl); + } + if (exdef.BuildReasons != null) { foreach (var key in exdef.BuildReasons.Keys) diff --git a/Manager/TFSBuildManager.Views/TFSBuildManager.Views.csproj b/Manager/TFSBuildManager.Views/TFSBuildManager.Views.csproj index 1787dba..2b25bb2 100644 --- a/Manager/TFSBuildManager.Views/TFSBuildManager.Views.csproj +++ b/Manager/TFSBuildManager.Views/TFSBuildManager.Views.csproj @@ -142,6 +142,7 @@ + diff --git a/Manager/TFSBuildManager.Views/ViewModels/BuildManagerViewModel.cs b/Manager/TFSBuildManager.Views/ViewModels/BuildManagerViewModel.cs index bd8cadc..53e5a7f 100644 --- a/Manager/TFSBuildManager.Views/ViewModels/BuildManagerViewModel.cs +++ b/Manager/TFSBuildManager.Views/ViewModels/BuildManagerViewModel.cs @@ -113,7 +113,7 @@ public BuildManagerViewModel(Window owner, ITfsClientRepository repository, IMai public ICommand DeleteCommand { get; private set; } public ICommand DisableCommand { get; private set; } - + public ICommand PauseCommand { get; private set; } public ICommand EnableCommand { get; private set; } @@ -145,7 +145,7 @@ public BuildManagerViewModel(Window owner, ITfsClientRepository repository, IMai public ICommand ViewBuildLogsCommand { get; private set; } public ICommand ShowQueuedDetailsCommand { get; private set; } - + public ICommand ResumeBuildCommand { get; private set; } public ICommand StopBuildCommand { get; private set; } @@ -163,7 +163,7 @@ public BuildManagerViewModel(Window owner, ITfsClientRepository repository, IMai public ICommand SetBelowNormalPriorityCommand { get; private set; } public ICommand SetLowPriorityCommand { get; private set; } - + public ICommand RetainIndefinitelyCommand { get; private set; } public ICommand SetBuildQualityCommand { get; private set; } @@ -187,7 +187,7 @@ public BuildManagerViewModel(Window owner, ITfsClientRepository repository, IMai public ICommand SetRetentionPoliciesCommand { get; private set; } public ICommand ChangeProcessParameterCommand { get; private set; } - + public ICommand QueueBuildsCommand { get; private set; } public ICommand QueueHighBuildsCommand { get; private set; } @@ -205,7 +205,7 @@ public BuildManagerViewModel(Window owner, ITfsClientRepository repository, IMai public ICommand RemapWorkspacesCommand { get; private set; } public ICommand RefreshCurrentView { get; private set; } - + public ICommand ImportBuildDefinition { get; private set; } public ObservableCollection BuildDefinitions { get; private set; } @@ -441,6 +441,31 @@ public static void ExportDefinition(BuildDefinitionViewModel b, string filePath) } } + if (processParameters.ContainsKey("TestSpecs")) + { + var testSpecs = processParameters["TestSpecs"] as TestSpecList; + if (testSpecs != null) + { + buildToExport.AgileTestSpecs = new List(); + foreach (var spec in testSpecs) + { + var agilespec = spec as AgileTestPlatformSpec; + if (agilespec != null) + { + ExportedAgileTestPlatformSpec expAgileSpec = new ExportedAgileTestPlatformSpec(); + expAgileSpec.AssemblyFileSpec = agilespec.AssemblyFileSpec; + expAgileSpec.ExecutionPlatform = agilespec.ExecutionPlatform; + expAgileSpec.FailBuildOnFailure = agilespec.FailBuildOnFailure; + expAgileSpec.RunName = agilespec.RunName; + expAgileSpec.TestCaseFilter = agilespec.TestCaseFilter; + expAgileSpec.RunSettingsFileName = agilespec.RunSettingsForTestRun.ServerRunSettingsFile; + expAgileSpec.TypeRunSettings = agilespec.RunSettingsForTestRun.TypeRunSettings; + buildToExport.AgileTestSpecs.Add(expAgileSpec); + } + } + } + } + buildToExport.ProcessParameters = WorkflowHelpers.DeserializeProcessParameters(b.BuildDefinition.ProcessParameters); foreach (KeyValuePair item in processParameters) { @@ -799,7 +824,7 @@ public void SetQueuedBuildPriority(QueuePriority priority) try { var items = this.view.SelectedActiveBuilds.ToList(); - + if (!items.Any()) { return; @@ -1189,7 +1214,7 @@ private void OnRefreshCurrentView() { this.OnRefresh(new EventArgs()); } - + private void OnImportBuildDefinition() { if (this.view.SelectedTeamProject == "All") @@ -1369,7 +1394,7 @@ private void OnCloneBuildToProject() private void OnRemapWorkspaces() { try - { + { if (this.selectedBuildView == BuildView.BuildDefinitions) { var buildDefinition = this.view.SelectedItems.First().BuildDefinition; @@ -1631,7 +1656,7 @@ private void OnChangeTrigger() this.view.DisplayError(ex); } } - + private void OnChangeOutputLocationAsConfiguredCommand() { var items = this.view.SelectedItems;