diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/FlyingStartCollectionMethodSeq.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/FlyingStartCollectionMethodSeq.cs index 0c98d9384..64a35ff4b 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/FlyingStartCollectionMethodSeq.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/FlyingStartCollectionMethodSeq.cs @@ -26,7 +26,7 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod /// Event.OpArgumentError . Target flow is out of range /// Event.Error . . . . . . Unspecified error /// - public IList Execute(Entities.Test test) + public IList Execute(Entities.Test test, TestParams testParams) { Elde.ControlBoardDev cBrd = StateMachine.ControlBoard; @@ -60,6 +60,8 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod /// Start the test, initialize test results Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, totalPulses)); Entities.TestResult tstRslt = new Entities.TestResult(test, repetitionNr, Entities.MetersKind.Single); + tstRslt.DoNotEvaluate = !testParams.Evaluate; + tstRslt.DoNotPublish = !testParams.Publish; int flowSetTime0 = StateMachine.Time; diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethod.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethod.cs index dd300da3c..7c345b253 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethod.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethod.cs @@ -1,5 +1,6 @@ /// /// Copyright (c) 2013-2015 Sensus Metering Systems +/// Author: Milan Hanajík /// using System; using System.Collections.Generic; @@ -13,8 +14,10 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod private static readonly ILog log = LogManager.GetLogger(typeof(TestMethod)); public override string ToString() { return string.Format("TestMethods.FlyingStartCollectionMethod({0})", Cfg.ToString(1)); } - public bool Evaluate { get { return true; } } - public bool Publish { get { return true; } } + readonly TestMethodCfg testMethodCfg; + + public bool Evaluate { get { return testMethodCfg.TestParams.Evaluate; } } + public bool Publish { get { return testMethodCfg.TestParams.Publish; } } public bool CanTest(Entities.MetersKind meters) { return meters == Entities.MetersKind.Single; } public TestMethod() @@ -24,12 +27,13 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod public TestMethod(TestMethodCfg cfg) : base(cfg) { + testMethodCfg = cfg; log.Debug(this.ToString()); } public IList Execute(Entities.Test test) { - return (new FlyingStartCollectionMethodSeq()).Execute(test); + return (new FlyingStartCollectionMethodSeq()).Execute(test, testMethodCfg.TestParams); } } } diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethodCfg.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethodCfg.cs index de607823c..821be38dd 100644 --- a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethodCfg.cs +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestMethodCfg.cs @@ -14,6 +14,17 @@ namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod public IComponent GetComponent(IList components) { return new TestMethod(this); } public IComponentCfgCtrl GetControl() { return new TestMethodCfgCtrl(); } + /// Test parameters + [XmlIgnore] + public TestParams TestParams; + public override IParamsProvider GetTestParams() { return TestParams; } + public override IParamsProvider CreateTestParams(Entities.Test test) + { + TestParams testParams = new TestParams(); + testParams.UpdateTestParams(Name, test); + return testParams; + } + /// Private parameterless constructor invoked by all other (public) constructors TestMethodCfg() { diff --git a/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestParams.cs b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestParams.cs new file mode 100644 index 000000000..090a347b1 --- /dev/null +++ b/TestBenchFramework/BenchControl/TestMethods/FlyingStartCollectionMethod/TestParams.cs @@ -0,0 +1,105 @@ +/// +/// Copyright (c) 2015 Sensus Metering Systems +/// Author: Milan Hanajík +/// +using System; +using System.IO; +using System.Xml.Serialization; +using TBF.BenchControl.Generic; +using TBF.Resources; + +namespace TBF.BenchControl.TestMethods.FlyingStartCollectionMethod +{ + public class TestParams : TestParamsBase, IParamsProvider, ITestParams + { + public bool Evaluate; /// Evaluate this test for passed/failed final result + public bool Publish; /// Publish this test in results (screen, printed, file, DB) + + public override void InitializeAll() + { + Evaluate = false; + } + + + string[] paramNames = new string[] + { + Strings.Evaluate, + Strings.Publish, + }; + public override string ParamName(int i) { return paramNames[i]; } + public override int ParamsCount() { return paramNames.Length; } + + public override string ToString(int i) + { + switch (i) + { + case 0: return (Evaluate ? Strings.yes : Strings.no); + case 1: return (Publish ? Strings.yes : Strings.no); + default: return string.Empty; + } + } + + public void UpdateParam(int i, string strValue) + { + switch (i) + { + case 0: Evaluate = strValue.Equals(Strings.yes); return; + case 1: Publish = strValue.Equals(Strings.yes); return; + default: return; + } + } + + public bool ValidateParam(int i, string strValue, out string message) + { + message = string.Empty; + + float dummy; + switch (i) + { + case 0: + case 1: + if (strValue.Equals(Strings.yes) || strValue.Equals(Strings.no)) return true; + break; + default: + message = "Invalid index"; + return false; + } + + message = ParamName(i) + " is invalid"; + return false; + } + + public override void UpdateTestParams(Entities.ComponentTest dbEntity) + { + if (dbEntity == null) return; + try + { + TestParams tmp = (TestParams)(new XmlSerializer(typeof(TestParams))) + .Deserialize(new StringReader(dbEntity.Parameters)); + + testParamsEntity = dbEntity; + componentName = dbEntity.CmpntName; + test = dbEntity.Test; + + Evaluate = tmp.Evaluate; + } + catch + { + } + } + + /// + /// Parameterless constructor initializes the parameters + /// + public TestParams() + { + } + + public TestParams(Entities.ComponentTest testParamsEntity, string componentName, Entities.Test test) + { + this.testParamsEntity = testParamsEntity; + this.componentName = componentName; + this.test = test; + } + } +} diff --git a/TestBenchFramework/Properties/AssemblyInfo.cs b/TestBenchFramework/Properties/AssemblyInfo.cs index 5635c2ec8..1432702fe 100644 --- a/TestBenchFramework/Properties/AssemblyInfo.cs +++ b/TestBenchFramework/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("1.5.89.1")] -[assembly: AssemblyFileVersion("1.5.89.1")] +[assembly: AssemblyVersion("1.5.90.1")] +[assembly: AssemblyFileVersion("1.5.90.1")] diff --git a/TestBenchFramework/Resources/Strings.Designer.cs b/TestBenchFramework/Resources/Strings.Designer.cs index fc20dffc8..6e128a6e4 100644 --- a/TestBenchFramework/Resources/Strings.Designer.cs +++ b/TestBenchFramework/Resources/Strings.Designer.cs @@ -906,6 +906,15 @@ namespace TBF.Resources { } } + /// + /// Looks up a localized string similar to Evaluate. + /// + internal static string Evaluate { + get { + return ResourceManager.GetString("Evaluate", resourceCulture); + } + } + /// /// Looks up a localized string similar to Exit. /// @@ -1806,6 +1815,15 @@ namespace TBF.Resources { } } + /// + /// Looks up a localized string similar to Publish. + /// + internal static string Publish { + get { + return ResourceManager.GetString("Publish", resourceCulture); + } + } + /// /// Looks up a localized string similar to Pulses per liter. /// diff --git a/TestBenchFramework/Resources/Strings.resx b/TestBenchFramework/Resources/Strings.resx index 55dec8f87..6cdfbe61d 100644 --- a/TestBenchFramework/Resources/Strings.resx +++ b/TestBenchFramework/Resources/Strings.resx @@ -1090,4 +1090,10 @@ Approved by + + Evaluate + + + Publish + \ No newline at end of file diff --git a/TestBenchFramework/TBF.csproj b/TestBenchFramework/TBF.csproj index 40619d8d7..f17eb2217 100644 --- a/TestBenchFramework/TBF.csproj +++ b/TestBenchFramework/TBF.csproj @@ -328,6 +328,7 @@ TestMethodCfgCtrl.cs +