From 513ef47e33dc688a3b9a2de1f3116ed0f989478d Mon Sep 17 00:00:00 2001 From: Karl Harnagy Date: Fri, 28 Feb 2014 12:08:44 -0500 Subject: [PATCH] Issue #4 --- NUnitActionEditor.cs | 17 ++++++++++++++++- NUnitAppAction.cs | 12 ++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/NUnitActionEditor.cs b/NUnitActionEditor.cs index 7d578f7..bae6400 100644 --- a/NUnitActionEditor.cs +++ b/NUnitActionEditor.cs @@ -18,6 +18,7 @@ internal sealed class NUnitActionEditor : ActionEditorBase private DropDownList ddlFrameworkVersion; private ValidatingTextBox txtAdditionalArguments; private ValidatingTextBox txtCustomXmlOutputPath; + private CheckBox chkTreatInconclusiveTestsAsFailure; /// /// Initializes a new instance of the class. @@ -81,6 +82,12 @@ protected override void CreateChildControls() DefaultText = "Managed by BuildMaster" }; + this.chkTreatInconclusiveTestsAsFailure = new CheckBox + { + Text = "Treat Inconclusive Tests as Failures", + Checked = true + }; + this.Controls.Add( new FormFieldGroup( "NUnit Executable Path", @@ -106,6 +113,12 @@ protected override void CreateChildControls() false, new StandardFormField("XML Output Path:", this.txtCustomXmlOutputPath) ), + new FormFieldGroup( + "NUnit Options", + "Specify any additional options for NUnit here.", + false, + new StandardFormField("", this.chkTreatInconclusiveTestsAsFailure) + ), new FormFieldGroup( "Group Name", "The Group name allows you to easily identify the unit test.", @@ -131,6 +144,7 @@ public override void BindToForm(ActionBase extension) this.ddlFrameworkVersion.SelectedValue = nunitAction.FrameworkVersion ?? ""; this.txtAdditionalArguments.Text = nunitAction.AdditionalArguments; this.txtCustomXmlOutputPath.Text = nunitAction.CustomXmlOutputPath; + this.chkTreatInconclusiveTestsAsFailure.Checked = nunitAction.TreatInconclusiveAsFailure; } public override ActionBase CreateFromForm() @@ -142,7 +156,8 @@ public override ActionBase CreateFromForm() GroupName = this.txtGroupName.Text, FrameworkVersion = this.ddlFrameworkVersion.SelectedValue, AdditionalArguments = this.txtAdditionalArguments.Text, - CustomXmlOutputPath = this.txtCustomXmlOutputPath.Text + CustomXmlOutputPath = this.txtCustomXmlOutputPath.Text, + TreatInconclusiveAsFailure = this.chkTreatInconclusiveTestsAsFailure.Checked }; } } diff --git a/NUnitAppAction.cs b/NUnitAppAction.cs index 6eba069..cf6e8a5 100644 --- a/NUnitAppAction.cs +++ b/NUnitAppAction.cs @@ -25,6 +25,7 @@ public sealed class NUnitAppAction : UnitTestActionBase /// public NUnitAppAction() { + this.TreatInconclusiveAsFailure = true; } /// @@ -57,6 +58,12 @@ public NUnitAppAction() [Persistent] public string CustomXmlOutputPath { get; set; } + /// + /// Gets or sets a value indicating whether to treat inconclusive tests as failures. + /// + [Persistent] + public bool TreatInconclusiveAsFailure { get; set; } + /// /// Returns a that represents this instance. /// @@ -114,8 +121,9 @@ protected override void RunTests() LogInformation(String.Format("NUnit Test: {0} (skipped)", testName)); continue; } - - bool nodeResult = node.Attributes["success"].Value.Equals("True", StringComparison.OrdinalIgnoreCase); + + bool nodeResult = node.Attributes["success"].Value.Equals("True", StringComparison.OrdinalIgnoreCase) || + (!this.TreatInconclusiveAsFailure && node.Attributes["result"].Value.Equals("inconclusive", StringComparison.OrdinalIgnoreCase)); double testLength = double.Parse(node.Attributes["time"].Value);