using System; namespace OpenTap { /// /// Test step break conditions. Can be used to define when a test step should issue a break due to it's own verdict. /// [Flags] public enum BreakCondition { /// Inherit behavior from parent or engine settings. [Display("Inherit", "Inherit behavior from the parent step. If no parent step exist or specify a behavior, the Engine setting 'Stop Test Plan Run If' is used.")] Inherit = 1, /// If a step completes with verdict 'Error', stop execution of any subsequent steps at this level, and return control to the parent step. [Display("Break on Error", "If a step completes with verdict 'Error', skip execution of subsequent steps and return control to the parent step.")] BreakOnError = 2, /// If a step completes with verdict 'Fail', stop execution of any subsequent steps at this level, and return control to the parent step. [Display("Break on Fail", "If a step completes with verdict 'Fail', skip execution of subsequent steps and return control to the parent step.")] BreakOnFail = 4, /// If a step completes with verdict 'Inconclusive', stop execution of any subsequent steps at this level, and return control to the parent step. [Display("Break on Inconclusive", "If a step completes with verdict 'inconclusive', skip execution of subsequent steps and return control to the parent step.")] BreakOnInconclusive = 8, /// If a step completes with verdict 'Pass', stop execution of any subsequent steps at this level, and return control to the parent step. [Display("Break on Pass", "If a step completes with verdict 'pass', skip execution of subsequent steps and return control to the parent step.")] BreakOnPass = 16 } /// /// Break condition is an 'attached property' that can be attached to any implementor of ITestStep. This ensures that the API for ITestStep does not need to be modified to support the BreakConditions feature. /// public static class BreakConditionProperty { /// Sets the break condition for a test step. /// Which step to set it on. /// public static void SetBreakCondition(ITestStepParent step, BreakCondition condition) { DynamicMemberTypeDataProvider.TestStepTypeData.BreakConditions.SetValue(step, condition); } /// Gets the break condition for a given test step. /// /// public static BreakCondition GetBreakCondition(ITestStepParent step) { return (BreakCondition) DynamicMemberTypeDataProvider.TestStepTypeData.BreakConditions.GetValue(step); } } /// Internal interface to speed up setting and getting BreakConditions on core classes like TestStep. internal interface IBreakConditionProvider { BreakCondition BreakCondition { get; set; } } /// Internal interface to speed up setting and getting Descriptions on core classes like TestStep. internal interface IDescriptionProvider { string Description { get; set; } } }