Changes in MainSeq, Procedure, BenchControlPanel, TestProgressControls, etc., ver. 2.26.1583
This commit is contained in:
parent
c403f9345f
commit
b2df02dd1b
@ -1,4 +1,7 @@
|
|||||||
using System;
|
///
|
||||||
|
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||||
|
///
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
using System;
|
///
|
||||||
|
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||||
|
///
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -8,5 +11,11 @@ namespace Common
|
|||||||
{
|
{
|
||||||
public class Utils
|
public class Utils
|
||||||
{
|
{
|
||||||
|
public static string GetTestName(string name, int repeats, int repetitionNr)
|
||||||
|
{
|
||||||
|
if (name == null) return null;
|
||||||
|
if (repeats == 1) return name;
|
||||||
|
return string.Format("{0} ({1}/{2})", name, repetitionNr, repeats);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -91,6 +91,7 @@
|
|||||||
<Compile Include="Entities\Profile.cs" />
|
<Compile Include="Entities\Profile.cs" />
|
||||||
<Compile Include="Entities\PTest.cs" />
|
<Compile Include="Entities\PTest.cs" />
|
||||||
<Compile Include="Entities\Test.cs" />
|
<Compile Include="Entities\Test.cs" />
|
||||||
|
<Compile Include="Entities\TestInstance.cs" />
|
||||||
<Compile Include="Entities\TransitionSequence.cs" />
|
<Compile Include="Entities\TransitionSequence.cs" />
|
||||||
<Compile Include="Entities\TransitionStep.cs" />
|
<Compile Include="Entities\TransitionStep.cs" />
|
||||||
<Compile Include="Entities\Uncertainty.cs" />
|
<Compile Include="Entities\Uncertainty.cs" />
|
||||||
@ -141,6 +142,10 @@
|
|||||||
<EmbeddedResource Include="Resources\Strings.zh-CN.resx" />
|
<EmbeddedResource Include="Resources\Strings.zh-CN.resx" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Common\Common.csproj">
|
||||||
|
<Project>{c8939821-ba5c-4988-a3d0-bf53b74865c7}</Project>
|
||||||
|
<Name>Common</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\Users\Users.csproj">
|
<ProjectReference Include="..\Users\Users.csproj">
|
||||||
<Project>{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}</Project>
|
<Project>{6E5CB0E9-E1B6-4E5D-AC6E-B1049E180F2B}</Project>
|
||||||
<Name>Users</Name>
|
<Name>Users</Name>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
///
|
///
|
||||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||||
///
|
///
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -53,14 +53,13 @@ namespace Config.Entities
|
|||||||
public virtual IList<ComponentProcedure> MoreParams { get; set; }
|
public virtual IList<ComponentProcedure> MoreParams { get; set; }
|
||||||
public virtual IList<Test> Tests { get; set; }
|
public virtual IList<Test> Tests { get; set; }
|
||||||
|
|
||||||
|
TestInstance[] testInstances;
|
||||||
|
|
||||||
/// Wrapper
|
/// Wrapper
|
||||||
public virtual IList<Test> RegularTests()
|
public virtual IList<Test> RegularTests()
|
||||||
{
|
{
|
||||||
IList<Test> rslt = new List<Test>();
|
IList<Test> rslt = new List<Test>();
|
||||||
foreach (var t in Tests)
|
foreach (var t in Tests) if (t.IsRegular()) rslt.Add(t);
|
||||||
{
|
|
||||||
if ((t.Name.Length > 0 && t.Name[0] != '[') || !t.Name.Contains("]")) rslt.Add(t);
|
|
||||||
}
|
|
||||||
return rslt;
|
return rslt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,6 +69,7 @@ namespace Config.Entities
|
|||||||
{
|
{
|
||||||
MoreParams = new List<ComponentProcedure>();
|
MoreParams = new List<ComponentProcedure>();
|
||||||
Tests = new List<Test>();
|
Tests = new List<Test>();
|
||||||
|
testInstances = null;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Default values
|
/// Default values
|
||||||
@ -96,6 +96,70 @@ namespace Config.Entities
|
|||||||
ItemNr = itemNr;
|
ItemNr = itemNr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual TestInstance[] UpdateTestInstances(IList<string> loopStartNames, IList<string> loopEndNames, IList<string> autoTests = null)
|
||||||
|
{
|
||||||
|
List<TestInstance> instances = new List<TestInstance>();
|
||||||
|
|
||||||
|
if (Tests != null)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
while (i < Tests.Count)
|
||||||
|
{
|
||||||
|
if (!loopStartNames.Contains(Tests[i].Method) && !loopEndNames.Contains(Tests[i].Method)) /// Loop.End is ignored outside a loop
|
||||||
|
{
|
||||||
|
///
|
||||||
|
/// Outside a loop
|
||||||
|
///
|
||||||
|
for (int j = 1; j <= Tests[i].Repeats; j++)
|
||||||
|
if (Tests[i].BelongsTo(autoTests))
|
||||||
|
instances.Add(new TestInstance(Tests[i], j));
|
||||||
|
}
|
||||||
|
else if (loopStartNames.Contains(Tests[i].Method))
|
||||||
|
{
|
||||||
|
///
|
||||||
|
/// Entering a loop
|
||||||
|
///
|
||||||
|
int loopsCount = Tests[i].Repeats;
|
||||||
|
List<Test> testsInsideLoop = new List<Test>();
|
||||||
|
i++;
|
||||||
|
|
||||||
|
while (i < Tests.Count && !loopEndNames.Contains(Tests[i].Method))
|
||||||
|
{
|
||||||
|
///
|
||||||
|
/// Inside a loop
|
||||||
|
///
|
||||||
|
if (Tests[i].Repeats == loopsCount && !loopStartNames.Contains(Tests[i].Method)) /// Loop.Start is ignored inside a loop
|
||||||
|
{
|
||||||
|
if (Tests[i].BelongsTo(autoTests))
|
||||||
|
testsInsideLoop.Add(Tests[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Append instances of tests inside the last loop to the list
|
||||||
|
///
|
||||||
|
for (int j = 1; j <= loopsCount; j++)
|
||||||
|
{
|
||||||
|
foreach (var t in testsInsideLoop)
|
||||||
|
instances.Add(new TestInstance(t, j));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
testInstances = instances.ToArray();
|
||||||
|
return testInstances;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual TestInstance[] GetTestInstances()
|
||||||
|
{
|
||||||
|
return testInstances;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual Procedure Clone()
|
public virtual Procedure Clone()
|
||||||
{
|
{
|
||||||
Procedure result = new Procedure();
|
Procedure result = new Procedure();
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
///
|
///
|
||||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||||
///
|
///
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -108,6 +108,22 @@ namespace Config.Entities
|
|||||||
Procedure = procedure;
|
Procedure = procedure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual bool IsRegular()
|
||||||
|
{
|
||||||
|
/// Irregular / event triggered test names have form "[event] TestName"
|
||||||
|
return (Name.Length > 0 && Name[0] != '[') || !Name.Contains("]");
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual bool BelongsTo(IList<string> autoTests)
|
||||||
|
{
|
||||||
|
if (IsRegular()) return true;
|
||||||
|
|
||||||
|
if (autoTests == null) return false;
|
||||||
|
|
||||||
|
string action = Name.Substring(1, Name.IndexOf(']') - 1);
|
||||||
|
return autoTests.Contains(action);
|
||||||
|
}
|
||||||
|
|
||||||
// Makes a new copy of this object (not just a reference)
|
// Makes a new copy of this object (not just a reference)
|
||||||
public virtual Test Clone()
|
public virtual Test Clone()
|
||||||
{
|
{
|
||||||
|
|||||||
32
Config/Entities/TestInstance.cs
Normal file
32
Config/Entities/TestInstance.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
///
|
||||||
|
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||||
|
///
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Config.Entities
|
||||||
|
{
|
||||||
|
public class TestInstance
|
||||||
|
{
|
||||||
|
public Test Test;
|
||||||
|
public int Repetition;
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return (Test != null) ? Common.Utils.GetTestName(Test.Name, Test.Repeats, Repetition) : string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TestInstance(Test test, int repetition)
|
||||||
|
{
|
||||||
|
Test = test;
|
||||||
|
Repetition = repetition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -195,6 +195,10 @@
|
|||||||
<Compile Include="WMeterRsltItemSpec.cs" />
|
<Compile Include="WMeterRsltItemSpec.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Common\Common.csproj">
|
||||||
|
<Project>{c8939821-ba5c-4988-a3d0-bf53b74865c7}</Project>
|
||||||
|
<Name>Common</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\Config\Config.csproj">
|
<ProjectReference Include="..\Config\Config.csproj">
|
||||||
<Project>{743DF7DB-C7B6-42EB-986D-0F485E5588E4}</Project>
|
<Project>{743DF7DB-C7B6-42EB-986D-0F485E5588E4}</Project>
|
||||||
<Name>Config</Name>
|
<Name>Config</Name>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
///
|
///
|
||||||
/// Copyright (c) 2016-2019 Sensus Slovensko a.s.
|
/// Copyright (c) 2016-2021 Sensus Slovensko a.s.
|
||||||
///
|
///
|
||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -11,9 +11,7 @@ namespace Results
|
|||||||
{
|
{
|
||||||
public static string GetTestName(string name, int repeats, int repetitionNr)
|
public static string GetTestName(string name, int repeats, int repetitionNr)
|
||||||
{
|
{
|
||||||
if (name == null) return null;
|
return Common.Utils.GetTestName(name, repeats, repetitionNr);
|
||||||
if (repeats == 1) return name;
|
|
||||||
return string.Format("{0} ({1}/{2})", name, repetitionNr, repeats);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
///
|
///
|
||||||
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
|
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||||
///
|
///
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -106,7 +106,6 @@ namespace TBF.BenchControl.Sequences
|
|||||||
Selection selection;
|
Selection selection;
|
||||||
string selectedTestName;
|
string selectedTestName;
|
||||||
|
|
||||||
#if !DEBUG
|
|
||||||
Bridge.OnActivity(this, Strings.Starting_system);
|
Bridge.OnActivity(this, Strings.Starting_system);
|
||||||
WaitForOkButton();
|
WaitForOkButton();
|
||||||
SetValvesToDefaultState();
|
SetValvesToDefaultState();
|
||||||
@ -159,7 +158,6 @@ namespace TBF.BenchControl.Sequences
|
|||||||
if (e.Contains(Event.UiCmdStop)) goto stop;
|
if (e.Contains(Event.UiCmdStop)) goto stop;
|
||||||
}
|
}
|
||||||
while (!e.Contains(Event.BalanceDone));
|
while (!e.Contains(Event.BalanceDone));
|
||||||
#endif
|
|
||||||
|
|
||||||
select_procedure:
|
select_procedure:
|
||||||
|
|
||||||
@ -701,29 +699,40 @@ namespace TBF.BenchControl.Sequences
|
|||||||
IList<DeferredTestEvaluationData> deferredData = new List<DeferredTestEvaluationData>();
|
IList<DeferredTestEvaluationData> deferredData = new List<DeferredTestEvaluationData>();
|
||||||
bool veryFirstTestInTheRestOfCycle = true;
|
bool veryFirstTestInTheRestOfCycle = true;
|
||||||
|
|
||||||
int selsctedTestIx = simultWithPurgingCount; /// Applies when selection == Selection.Cycle
|
int selsctedTestIx = -1; ///= undefined
|
||||||
int repetNr = 1;
|
|
||||||
///
|
///
|
||||||
if (selection == Selection.RestOfCycle) /// ... otherwise
|
if (selection == Selection.RestOfCycle) /// ... otherwise
|
||||||
{
|
{
|
||||||
Test slctdTest = TBF.BenchControl.StateMachine.Procedure.GetTest(selectedTestName, out selsctedTestIx, out repetNr);
|
for (int i = 0; i < StateMachine.TestInstances.Length; i++)
|
||||||
if (slctdTest == null || (selsctedTestIx < simultWithPurgingCount)
|
{
|
||||||
|| (selsctedTestIx >= StateMachine.Tests.Count - simultWithEvacuationCount))
|
if (selectedTestName == StateMachine.TestInstances[i].Name)
|
||||||
|
{
|
||||||
|
selsctedTestIx = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((selsctedTestIx < simultWithPurgingCount) ||
|
||||||
|
(selsctedTestIx >= StateMachine.TestInstances.Length - simultWithEvacuationCount))
|
||||||
{
|
{
|
||||||
/// Invalid test selection
|
/// Invalid test selection
|
||||||
UiBridge.Bridge.OnError(this, string.Format("No test specified"));
|
UiBridge.Bridge.OnError(this, string.Format("No test specified"));
|
||||||
goto select_cycle_or_test;
|
goto select_cycle_or_test;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
selsctedTestIx = simultWithPurgingCount; /// Applies when selection == Selection.Cycle
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
float TimeEstimateTotal = 0; /// Time estimate of the selected cycle or test
|
float TimeEstimateTotal = 0; /// Time estimate of the selected cycle or test
|
||||||
|
|
||||||
for (int i = selsctedTestIx; i < StateMachine.Tests.Count - simultWithEvacuationCount; i++)
|
for (int i = selsctedTestIx; i < StateMachine.TestInstances.Length - simultWithEvacuationCount; i++)
|
||||||
{
|
{
|
||||||
Test test = StateMachine.Tests[i];
|
Test test = StateMachine.TestInstances[i].Test;
|
||||||
|
|
||||||
TimeEstimateTotal += (test.Repeats * (test.TstTime + 10.0f));
|
TimeEstimateTotal += (test.TstTime + 10.0f);
|
||||||
|
|
||||||
/// Try to fetch all test paths and transitions
|
/// Try to fetch all test paths and transitions
|
||||||
/// to detect configuration errors as early as possible.
|
/// to detect configuration errors as early as possible.
|
||||||
@ -743,19 +752,16 @@ namespace TBF.BenchControl.Sequences
|
|||||||
}
|
}
|
||||||
|
|
||||||
int currentTestIx = selsctedTestIx;
|
int currentTestIx = selsctedTestIx;
|
||||||
bool isOuterLoopMode = false;
|
while (currentTestIx < StateMachine.TestInstances.Length - simultWithEvacuationCount)
|
||||||
int outerLoopStartIx = -1; /// This is to identify program errors
|
|
||||||
int outerLoopRepeats = 0;
|
|
||||||
while (currentTestIx < StateMachine.Tests.Count - simultWithEvacuationCount)
|
|
||||||
{
|
{
|
||||||
Test nextTest = (currentTestIx + 1 < StateMachine.Tests.Count - simultWithEvacuationCount)
|
TestInstance nextTest = (currentTestIx + 1 < StateMachine.TestInstances.Length - simultWithEvacuationCount)
|
||||||
? StateMachine.Tests[currentTestIx + 1]
|
? StateMachine.TestInstances[currentTestIx + 1]
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
Test nextHydroTest = null;
|
Test nextHydroTest = null;
|
||||||
for (int i = currentTestIx + 1; i < StateMachine.Tests.Count - simultWithEvacuationCount; i++)
|
for (int i = currentTestIx + 1; i < StateMachine.TestInstances.Length - simultWithEvacuationCount; i++)
|
||||||
{
|
{
|
||||||
Test tst = StateMachine.Tests[i];
|
Test tst = StateMachine.TestInstances[i].Test;
|
||||||
if (tst != null)
|
if (tst != null)
|
||||||
{
|
{
|
||||||
ITestMethod tm = TbfComponents.FindComponent(tst.Method) as ITestMethod;
|
ITestMethod tm = TbfComponents.FindComponent(tst.Method) as ITestMethod;
|
||||||
@ -803,12 +809,10 @@ namespace TBF.BenchControl.Sequences
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Fetch paths and transitions of this test
|
/// Fetch paths and transitions of this test
|
||||||
Test test = StateMachine.Tests[currentTestIx];
|
TestInstance testInst = StateMachine.TestInstances[currentTestIx];
|
||||||
TBF.BenchControl.Generic.IComponent testMethodComp = TbfComponents.FindComponent(test.Method);
|
TBF.BenchControl.Generic.IComponent testMethodComp = TbfComponents.FindComponent(testInst.Test.Method);
|
||||||
string errorMsg;
|
string errorMsg;
|
||||||
if (!(testMethodComp is TBF.BenchControl.TestMethods.OuterLoop.Start.Component) &&
|
if (!StateMachine.GetPaths(testInst.Test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter),
|
||||||
!(testMethodComp is TBF.BenchControl.TestMethods.OuterLoop.End.Component) &&
|
|
||||||
!StateMachine.GetPaths(test, (StateMachine.Procedure.MetersKind == MetersKind.HeatMeter),
|
|
||||||
out inPath, out benchPath, out outPath, out sensPath,
|
out inPath, out benchPath, out outPath, out sensPath,
|
||||||
out heatMetersPath,
|
out heatMetersPath,
|
||||||
out transitionBefore, out transitionBetween, out transitionAfter,
|
out transitionBefore, out transitionBetween, out transitionAfter,
|
||||||
@ -830,12 +834,7 @@ namespace TBF.BenchControl.Sequences
|
|||||||
ITestMethod testMethod = testMethodComp as ITestMethod;
|
ITestMethod testMethod = testMethodComp as ITestMethod;
|
||||||
if (testMethod != null && testMethod.CanTest(StateMachine.Procedure.MetersKind))
|
if (testMethod != null && testMethod.CanTest(StateMachine.Procedure.MetersKind))
|
||||||
{
|
{
|
||||||
if (isOuterLoopMode && (outerLoopRepeats != test.Repeats) && !(testMethod is TestMethods.OuterLoop.End.Component))
|
StateMachine.LoadTestParams(testInst.Test);
|
||||||
{
|
|
||||||
goto config_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
StateMachine.LoadTestParams(test);
|
|
||||||
|
|
||||||
if ((sensPath != null) && (sensPath.RegisterReaders != null))
|
if ((sensPath != null) && (sensPath.RegisterReaders != null))
|
||||||
{
|
{
|
||||||
@ -866,29 +865,29 @@ namespace TBF.BenchControl.Sequences
|
|||||||
int timeEstTransBetween = testMethod.DoTransitions() ? GetTransitionTimeEst(transitionBetween) : 1;
|
int timeEstTransBetween = testMethod.DoTransitions() ? GetTransitionTimeEst(transitionBetween) : 1;
|
||||||
int timeEstTransAfter = testMethod.DoTransitions() ? GetTransitionTimeEst(transitionAfter) : 1;
|
int timeEstTransAfter = testMethod.DoTransitions() ? GetTransitionTimeEst(transitionAfter) : 1;
|
||||||
|
|
||||||
TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, timeEstTransBefore, 1, 30, 0, Convert.ToInt32(test.TstTime) + 15, timeEstTransAfter, 0 });
|
TestProgressEventArgs.SetEstimatedTimes(new int[] { 1, timeEstTransBefore, 1, 30, 0, Convert.ToInt32(testInst.Test.TstTime) + 15, timeEstTransAfter, 0 });
|
||||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetNr, Config.Entities.Progress.JustStarted));
|
Bridge.OnTestProgress(this, new TestProgressEventArgs(testInst.Test, testInst.Repetition, Config.Entities.Progress.JustStarted));
|
||||||
|
|
||||||
bool currentTestFinished = true;
|
bool currentTestFinished = true;
|
||||||
bool doOneMoreRepetition = false;
|
bool doOneMoreRepetition = false;
|
||||||
do
|
|
||||||
{
|
bool doExecuteTransitionBefore = (currentTestIx == simultWithPurgingCount) || (testInst.Test != StateMachine.TestInstances[currentTestIx - 1].Test) || veryFirstTestInTheRestOfCycle;
|
||||||
bool doExecuteTransitionBefore = isOuterLoopMode || (repetNr == 1) || veryFirstTestInTheRestOfCycle;
|
bool isLastRepetition = (currentTestIx == StateMachine.TestInstances.Length - simultWithEvacuationCount - 1) || (testInst.Test != StateMachine.TestInstances[currentTestIx + 1].Test);
|
||||||
veryFirstTestInTheRestOfCycle = false;
|
veryFirstTestInTheRestOfCycle = false;
|
||||||
if (testMethod.DoTransitions())
|
if (testMethod.DoTransitions())
|
||||||
{
|
{
|
||||||
/// Make a transition before a test and before each test repetition
|
/// Make a transition before a test and before each test repetition
|
||||||
rsltTransBefore = Transition(doExecuteTransitionBefore ? transitionBefore : null, TransitionContext.BeforeTest); /// Transition or SetRoute - start of test
|
rsltTransBefore = Transition(doExecuteTransitionBefore ? transitionBefore : null, TransitionContext.BeforeTest); /// Transition or SetRoute - start of test
|
||||||
log.InfoFormat("Test {0}: Transition({1}, BeforeTest) returned {2}", test.Name, (transitionBefore == null ? "null" : transitionBefore.Name), rsltTransBefore);
|
log.InfoFormat("Test {0}: Transition({1}, BeforeTest) returned {2}", testInst.Name, (transitionBefore == null ? "null" : transitionBefore.Name), rsltTransBefore);
|
||||||
}
|
}
|
||||||
if (rsltTransBefore != Event.Done) break;
|
if (rsltTransBefore != Event.Done) break;
|
||||||
|
|
||||||
log.InfoFormat("Test {0}: Execute(., {1}, {2})", test.Name, repetNr, isOuterLoopMode || repetNr == test.Repeats);
|
log.InfoFormat("Test {0}: Execute(., {1}, {2})", testInst.Name, testInst.Repetition, isLastRepetition);
|
||||||
e = testMethod.Execute(test, repetNr, isOuterLoopMode || repetNr == test.Repeats);
|
e = testMethod.Execute(testInst.Test, testInst.Repetition, isLastRepetition);
|
||||||
|
|
||||||
if (e.Contains(Event.MakeSecondPass) && testMethod is ITestMethodWith2ndPass)
|
if (e.Contains(Event.MakeSecondPass) && testMethod is ITestMethodWith2ndPass)
|
||||||
{
|
{
|
||||||
deferredData.Add(new DeferredTestEvaluationData(test, repetNr, (testMethod as ITestMethodWith2ndPass).IntermediateData));
|
deferredData.Add(new DeferredTestEvaluationData(testInst.Test, testInst.Repetition, (testMethod as ITestMethodWith2ndPass).IntermediateData));
|
||||||
}
|
}
|
||||||
|
|
||||||
currentTestFinished = (rsltTransBefore == Event.Done && !e.Contains(Event.Error)
|
currentTestFinished = (rsltTransBefore == Event.Done && !e.Contains(Event.Error)
|
||||||
@ -896,26 +895,18 @@ namespace TBF.BenchControl.Sequences
|
|||||||
&& !e.Contains(Event.OpArgumentError)
|
&& !e.Contains(Event.OpArgumentError)
|
||||||
&& !e.Contains(Event.UiCmdStop));
|
&& !e.Contains(Event.UiCmdStop));
|
||||||
|
|
||||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetNr, currentTestFinished ? Config.Entities.Progress.Completed
|
Bridge.OnTestProgress(this, new TestProgressEventArgs(testInst.Test, testInst.Repetition, currentTestFinished ? Config.Entities.Progress.Completed
|
||||||
: Config.Entities.Progress.Aborted));
|
: Config.Entities.Progress.Aborted));
|
||||||
|
|
||||||
if (e.Contains(Event.OuterLoopStart)) break; /// Do not repeat OuterLoopStart test in this loop
|
if (testMethod.DoTransitions() && !e.Contains(Event.RecoverableError))
|
||||||
if (currentTestFinished && !isOuterLoopMode) repetNr++;
|
{
|
||||||
|
if (currentTestFinished && !isLastRepetition)
|
||||||
doOneMoreRepetition = currentTestFinished && !isOuterLoopMode && (repetNr <= test.Repeats);
|
|
||||||
|
|
||||||
if (testMethod.DoTransitions() && doOneMoreRepetition)
|
|
||||||
{
|
{
|
||||||
/// Make a transition between two test repetitions
|
/// Make a transition between two test repetitions
|
||||||
rsltTransBetween = Transition(transitionBetween, TransitionContext.BetweenTests); /// Transition or SetRoute - start of test
|
rsltTransBetween = Transition(transitionBetween, TransitionContext.BetweenTests); /// Transition or SetRoute - start of test
|
||||||
log.InfoFormat("Test {0}: Transition({1}, BetweenTests) returned {2}", test.Name, (transitionBetween == null ? "null" : transitionBetween.Name), rsltTransBetween);
|
log.InfoFormat("Test {0}: Transition({1}, BetweenTests) returned {2}", testInst.Name, (transitionBetween == null ? "null" : transitionBetween.Name), rsltTransBetween);
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
while ((rsltTransBetween == Event.Done) && doOneMoreRepetition);
|
|
||||||
|
|
||||||
if (currentTestFinished && !isOuterLoopMode && repetNr > test.Repeats) repetNr = 1; /// Reset repetNr
|
|
||||||
|
|
||||||
if (testMethod.DoTransitions() && !e.Contains(Event.RecoverableError))
|
|
||||||
{
|
{
|
||||||
/// Make a transition after the last test repetition
|
/// Make a transition after the last test repetition
|
||||||
TransitionContext endContext =
|
TransitionContext endContext =
|
||||||
@ -923,62 +914,31 @@ namespace TBF.BenchControl.Sequences
|
|||||||
: ((nextTransitionBefore != null) && (nextTransitionBefore.Name.ToLower().Contains("fastflow"))) ? TransitionContext.AfterTestWithOverlap
|
: ((nextTransitionBefore != null) && (nextTransitionBefore.Name.ToLower().Contains("fastflow"))) ? TransitionContext.AfterTestWithOverlap
|
||||||
: TransitionContext.AfterTest;
|
: TransitionContext.AfterTest;
|
||||||
rsltTransAfter = Transition(transitionAfter, endContext); /// Transition or SetRoute - end of test
|
rsltTransAfter = Transition(transitionAfter, endContext); /// Transition or SetRoute - end of test
|
||||||
log.InfoFormat("Test {0}: Transition({1}, {2}) returned {3}", test.Name, (transitionAfter == null ? "null" : transitionAfter.Name), endContext, rsltTransAfter);
|
log.InfoFormat("Test {0}: Transition({1}, {2}) returned {3}", testInst.Name, (transitionAfter == null ? "null" : transitionAfter.Name), endContext, rsltTransAfter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rsltTransBefore == Event.Error || rsltTransBetween == Event.Error|| e.Contains(Event.Error))
|
if (rsltTransBefore == Event.Error || rsltTransBetween == Event.Error|| e.Contains(Event.Error))
|
||||||
{
|
{
|
||||||
isOuterLoopMode = false;
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
else if (e.Contains(Event.ConfigurationError))
|
else if (e.Contains(Event.ConfigurationError))
|
||||||
{
|
{
|
||||||
isOuterLoopMode = false;
|
|
||||||
goto select_cycle_or_test; /// OR goto config_error; ???
|
goto select_cycle_or_test; /// OR goto config_error; ???
|
||||||
}
|
}
|
||||||
else if (e.Contains(Event.OpArgumentError))
|
else if (e.Contains(Event.OpArgumentError))
|
||||||
{
|
{
|
||||||
isOuterLoopMode = false;
|
|
||||||
goto config_error;
|
goto config_error;
|
||||||
}
|
}
|
||||||
else if (rsltTransBefore == Event.UiCmdStop || e.Contains(Event.UiCmdStop) || e.Contains(Event.RecoverableError))
|
else if (rsltTransBefore == Event.UiCmdStop || e.Contains(Event.UiCmdStop) || e.Contains(Event.RecoverableError))
|
||||||
{
|
{
|
||||||
isOuterLoopMode = false;
|
|
||||||
goto stop_within_cycle;
|
goto stop_within_cycle;
|
||||||
}
|
}
|
||||||
else if (e.Contains(Event.OuterLoopStart))
|
|
||||||
{
|
|
||||||
if (isOuterLoopMode)
|
|
||||||
{
|
|
||||||
goto config_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
isOuterLoopMode = true;
|
|
||||||
outerLoopRepeats = (nextTest != null) ? nextTest.Repeats : 1;
|
|
||||||
repetNr = 1;
|
|
||||||
outerLoopStartIx = currentTestIx;
|
|
||||||
}
|
|
||||||
else if (e.Contains(Event.OuterLoopEnd))
|
|
||||||
{
|
|
||||||
if (!isOuterLoopMode)
|
|
||||||
{
|
|
||||||
goto config_error;
|
|
||||||
}
|
|
||||||
else if (++repetNr <= outerLoopRepeats)
|
|
||||||
{
|
|
||||||
currentTestIx = outerLoopStartIx;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
isOuterLoopMode = false;
|
UiBridge.Bridge.OnError(this, string.Format(Strings.Method_0_cannot_be_used, testInst.Test.Method));
|
||||||
repetNr = 1; /// Reset repetNr
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UiBridge.Bridge.OnError(this, string.Format(Strings.Method_0_cannot_be_used, test.Method));
|
|
||||||
goto select_cycle_or_test;
|
goto select_cycle_or_test;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1035,15 +995,27 @@ namespace TBF.BenchControl.Sequences
|
|||||||
/// selection == Selection.Test or Selection.Q1 or Selection.Q2 or Selection.Q3
|
/// selection == Selection.Test or Selection.Q1 or Selection.Q2 or Selection.Q3
|
||||||
/// Single test will be executed
|
/// Single test will be executed
|
||||||
|
|
||||||
int repetNr;
|
int testIx = -1; ///= undefined
|
||||||
int testIx;
|
///
|
||||||
Test test = TBF.BenchControl.StateMachine.Procedure.GetTest(selectedTestName, out testIx, out repetNr);
|
for (int i = 0; i < StateMachine.TestInstances.Length; i++)
|
||||||
if (test == null)
|
|
||||||
{
|
{
|
||||||
|
if (selectedTestName == StateMachine.TestInstances[i].Name)
|
||||||
|
{
|
||||||
|
testIx = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (testIx < 0)
|
||||||
|
{
|
||||||
|
/// Invalid test selection
|
||||||
UiBridge.Bridge.OnError(this, string.Format("No test specified"));
|
UiBridge.Bridge.OnError(this, string.Format("No test specified"));
|
||||||
goto select_cycle_or_test;
|
goto select_cycle_or_test;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Test test = StateMachine.TestInstances[testIx].Test;
|
||||||
|
int repetNr = StateMachine.TestInstances[testIx].Repetition;
|
||||||
|
|
||||||
/// Fetch the test paths and transitions
|
/// Fetch the test paths and transitions
|
||||||
string errorMsg;
|
string errorMsg;
|
||||||
TBF.BenchControl.Generic.IComponent testMethodComp = TbfComponents.FindComponent(test.Method);
|
TBF.BenchControl.Generic.IComponent testMethodComp = TbfComponents.FindComponent(test.Method);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
///
|
///
|
||||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
/// Copyright (c) 2020-2021 Sensus Slovensko a.s.
|
||||||
///
|
///
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -700,15 +700,15 @@ namespace TBF.BenchControl.Sequences
|
|||||||
simultWithPurgingTests.Clear();
|
simultWithPurgingTests.Clear();
|
||||||
simultWithPurgingParams.Clear();
|
simultWithPurgingParams.Clear();
|
||||||
///
|
///
|
||||||
foreach (var test in StateMachine.Tests)
|
foreach (var ti in StateMachine.TestInstances)
|
||||||
{
|
{
|
||||||
Generic.IComponent testMethodComp = TbfComponents.FindComponent(test.Method);
|
Generic.IComponent testMethodComp = TbfComponents.FindComponent(ti.Test.Method);
|
||||||
if (testMethodComp == null) break;
|
if (testMethodComp == null) break;
|
||||||
|
|
||||||
testMethodComp.Cfg.LoadTestParamsFromDB(test);
|
testMethodComp.Cfg.LoadTestParamsFromDB(ti.Test);
|
||||||
|
|
||||||
ISimultTestMethod simultTest = testMethodComp as ISimultTestMethod;
|
ISimultTestMethod simultTest = testMethodComp as ISimultTestMethod;
|
||||||
MetersPath sensPath = StateMachine.GetMetersPath(test);
|
MetersPath sensPath = StateMachine.GetMetersPath(ti.Test);
|
||||||
|
|
||||||
if (simultTest == null || !simultTest.SimultWithPrevious || sensPath == null) break;
|
if (simultTest == null || !simultTest.SimultWithPrevious || sensPath == null) break;
|
||||||
|
|
||||||
@ -721,7 +721,7 @@ namespace TBF.BenchControl.Sequences
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
simultWithPurgingTests.Add(test);
|
simultWithPurgingTests.Add(ti.Test);
|
||||||
simultWithPurgingParams.Add(testMethodComp.Cfg.GetRuntimeTestParamsProvider().Clone() as Generic.ITestParams);
|
simultWithPurgingParams.Add(testMethodComp.Cfg.GetRuntimeTestParamsProvider().Clone() as Generic.ITestParams);
|
||||||
simultWithPurgingCount++;
|
simultWithPurgingCount++;
|
||||||
}
|
}
|
||||||
@ -734,9 +734,9 @@ namespace TBF.BenchControl.Sequences
|
|||||||
simultWithEvacuationTests.Clear();
|
simultWithEvacuationTests.Clear();
|
||||||
simultWithEvacuationParams.Clear();
|
simultWithEvacuationParams.Clear();
|
||||||
///
|
///
|
||||||
for (int i = StateMachine.Tests.Count - 1; i >= simultWithPurgingCount; i--)
|
for (int i = StateMachine.TestInstances.Length - 1; i >= simultWithPurgingCount; i--)
|
||||||
{
|
{
|
||||||
var test = StateMachine.Tests[i];
|
var test = StateMachine.TestInstances[i].Test;
|
||||||
|
|
||||||
Generic.IComponent testMethodComp = TbfComponents.FindComponent(test.Method);
|
Generic.IComponent testMethodComp = TbfComponents.FindComponent(test.Method);
|
||||||
if (testMethodComp == null) break;
|
if (testMethodComp == null) break;
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
///
|
///
|
||||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||||
///
|
///
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -1775,7 +1775,7 @@ namespace TBF.BenchControl.Sequences
|
|||||||
/// <returns>Test result</returns>
|
/// <returns>Test result</returns>
|
||||||
protected void MakeSimulatedHeatMeters(Config.Entities.Test test, int repetitionNr, int part, float errorPct, double energy, float energyErrLimLo, float energyErrLimHi, bool evaluateVolume)
|
protected void MakeSimulatedHeatMeters(Config.Entities.Test test, int repetitionNr, int part, float errorPct, double energy, float energyErrLimLo, float energyErrLimHi, bool evaluateVolume)
|
||||||
{
|
{
|
||||||
string fullTestName = Results.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
string fullTestName = Common.Utils.GetTestName(test.Name, test.Repeats, repetitionNr);
|
||||||
|
|
||||||
Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(fullTestName, part);
|
Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(fullTestName, part);
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
///
|
///
|
||||||
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
|
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||||
///
|
///
|
||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -65,6 +65,8 @@ namespace TBF.BenchControl
|
|||||||
public static IList<IValve> CoupledValves; /// list of coupled valves
|
public static IList<IValve> CoupledValves; /// list of coupled valves
|
||||||
public static IList<Elde.ValveEx.Valve> ExtendedValves; /// list of extended valves
|
public static IList<Elde.ValveEx.Valve> ExtendedValves; /// list of extended valves
|
||||||
|
|
||||||
|
public static IList<string> LoopStartNames;
|
||||||
|
public static IList<string> LoopEndNames;
|
||||||
|
|
||||||
/// Time and synchronization
|
/// Time and synchronization
|
||||||
#if TURA_IPERL || TURA_IPERL_NEW
|
#if TURA_IPERL || TURA_IPERL_NEW
|
||||||
@ -113,7 +115,7 @@ namespace TBF.BenchControl
|
|||||||
/// Loaded by LoadProcedure() or IOperation LoadProcedureOp(...)
|
/// Loaded by LoadProcedure() or IOperation LoadProcedureOp(...)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Procedure Procedure; /// Procedure
|
public static Procedure Procedure; /// Procedure
|
||||||
public static IList<Test> Tests; /// Tests
|
public static TestInstance[] TestInstances; /// Tests
|
||||||
public static bool IsRemoteProcedure;
|
public static bool IsRemoteProcedure;
|
||||||
|
|
||||||
|
|
||||||
@ -228,6 +230,8 @@ namespace TBF.BenchControl
|
|||||||
SequenceBase.PumpsWithFM = new List<IPumpFM>();
|
SequenceBase.PumpsWithFM = new List<IPumpFM>();
|
||||||
SequenceBase.WaterMeters = new List<IWaterMeter>();
|
SequenceBase.WaterMeters = new List<IWaterMeter>();
|
||||||
SequenceBase.Cameras = new List<ICamera>();
|
SequenceBase.Cameras = new List<ICamera>();
|
||||||
|
LoopStartNames = new List<string>();
|
||||||
|
LoopEndNames = new List<string>();
|
||||||
UInt128 valvesToInvert = 0;
|
UInt128 valvesToInvert = 0;
|
||||||
foreach (var cmpnt in components)
|
foreach (var cmpnt in components)
|
||||||
{
|
{
|
||||||
@ -266,6 +270,9 @@ namespace TBF.BenchControl
|
|||||||
BenchErrorOp = (cmpnt as GenericDevices.IParallelOutput).ShowBenchErrorOp();
|
BenchErrorOp = (cmpnt as GenericDevices.IParallelOutput).ShowBenchErrorOp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cmpnt is ITestMethod && cmpnt.ClassName == "TestMethods.OuterLoop.Start") LoopStartNames.Add(cmpnt.Name);
|
||||||
|
if (cmpnt is ITestMethod && cmpnt.ClassName == "TestMethods.OuterLoop.End") LoopEndNames.Add(cmpnt.Name);
|
||||||
|
|
||||||
if (cmpnt is IScaleOrTank)
|
if (cmpnt is IScaleOrTank)
|
||||||
{
|
{
|
||||||
IScaleOrTank tank = cmpnt as IScaleOrTank;
|
IScaleOrTank tank = cmpnt as IScaleOrTank;
|
||||||
@ -567,28 +574,13 @@ namespace TBF.BenchControl
|
|||||||
{
|
{
|
||||||
IsRemoteProcedure = isRemote;
|
IsRemoteProcedure = isRemote;
|
||||||
Procedure = selectedProcs[0];
|
Procedure = selectedProcs[0];
|
||||||
|
TestInstances = selectedProcs[0].UpdateTestInstances(LoopStartNames, LoopEndNames, autoTests);
|
||||||
Tests = selectedProcs[0].Tests;
|
|
||||||
for (int i = Tests.Count - 1; i >= 0; i--)
|
|
||||||
{
|
|
||||||
Test test = Tests[i];
|
|
||||||
if ((test.Name.Length > 0) && (test.Name[0] == '[') && test.Name.Contains("]"))
|
|
||||||
{
|
|
||||||
/// This is an AutoAction test => If 'actionName' is not on 'autoTests' list the test should be removed
|
|
||||||
int actionNameEndPos = test.Name.IndexOf(']');
|
|
||||||
string actionName = test.Name.Substring(1, actionNameEndPos - 1);
|
|
||||||
if (autoTests == null || autoTests.Count == 0 || !autoTests.Contains(actionName))
|
|
||||||
{
|
|
||||||
/// AutoAction test was not selected and should be deleted
|
|
||||||
Tests.RemoveAt(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LoadProcedureParams(Procedure procedure)
|
public static void LoadProcedureParams(Procedure procedure)
|
||||||
|
|||||||
@ -2684,9 +2684,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
|
|||||||
DateTime endTime = DateTime.Now;
|
DateTime endTime = DateTime.Now;
|
||||||
int testTime = StateMachine.Time - startTimeSec;
|
int testTime = StateMachine.Time - startTimeSec;
|
||||||
|
|
||||||
if (!tests.Contains(StateMachine.Tests[0]))
|
if (!tests.Contains(StateMachine.TestInstances[0].Test))
|
||||||
{
|
{
|
||||||
tests.Insert(0, StateMachine.Tests[0]); /// Add RFID test as the 1st item
|
tests.Insert(0, StateMachine.TestInstances[0].Test); /// Add RFID test as the 1st item
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var test in tests)
|
foreach (var test in tests)
|
||||||
|
|||||||
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
|||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion("2.26.1579.0")]
|
[assembly: AssemblyVersion("2.26.1583.0")]
|
||||||
[assembly: AssemblyFileVersion("2.26.1579.0")]
|
[assembly: AssemblyFileVersion("2.26.1583.0")]
|
||||||
|
|||||||
@ -196,7 +196,7 @@ namespace TBF.UI.Procedures.TestWizard
|
|||||||
{
|
{
|
||||||
if (t.Publish != (byte)Config.Entities.Publish.Never &&
|
if (t.Publish != (byte)Config.Entities.Publish.Never &&
|
||||||
t.Publish != (byte)Config.Entities.Publish.Internal &&
|
t.Publish != (byte)Config.Entities.Publish.Internal &&
|
||||||
((t.Name.Length > 0 && t.Name[0] != '[') || !t.Name.Contains("]")))
|
t.IsRegular())
|
||||||
{
|
{
|
||||||
/// This is a regular test,
|
/// This is a regular test,
|
||||||
/// not an internal/unpublished test, neither an auto action test
|
/// not an internal/unpublished test, neither an auto action test
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
///
|
///
|
||||||
/// Copyright (c) 2013-2017 Senus Slovensko a.s.
|
/// Copyright (c) 2013-2021 Senus Slovensko a.s.
|
||||||
///
|
///
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -183,14 +183,15 @@ namespace TBF.UI.Shared
|
|||||||
}
|
}
|
||||||
|
|
||||||
Program.MainWnd.CurrentProcedure = procedures[0];
|
Program.MainWnd.CurrentProcedure = procedures[0];
|
||||||
|
if (procedures[0].GetTestInstances() == null)
|
||||||
|
{
|
||||||
|
procedures[0].UpdateTestInstances(TBF.BenchControl.StateMachine.LoopStartNames, TBF.BenchControl.StateMachine.LoopEndNames, null);
|
||||||
|
}
|
||||||
|
|
||||||
testComboBox.Items.Clear();
|
testComboBox.Items.Clear();
|
||||||
foreach (var test in procedures[0].Tests)
|
foreach (var tinst in procedures[0].GetTestInstances())
|
||||||
{
|
{
|
||||||
for (int i = 1; i <= test.Repeats; i++)
|
testComboBox.Items.Add(tinst);
|
||||||
{
|
|
||||||
testComboBox.Items.Add(test.GetExpandedTestName(i));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (testComboBox.Items.Contains(oriTestName))
|
if (testComboBox.Items.Contains(oriTestName))
|
||||||
@ -198,24 +199,10 @@ namespace TBF.UI.Shared
|
|||||||
testComboBox.Text = oriTestName;
|
testComboBox.Text = oriTestName;
|
||||||
TestName = oriTestName;
|
TestName = oriTestName;
|
||||||
}
|
}
|
||||||
else if (procedures[0].Tests.Count > 0)
|
else if (testComboBox.Items.Count > 0)
|
||||||
{
|
{
|
||||||
Test test = procedures[0].Tests[0];
|
testComboBox.Text = testComboBox.Items[0].ToString();
|
||||||
string title;
|
TestName = testComboBox.Items[0].ToString();
|
||||||
if (test.Repeats == 1)
|
|
||||||
{
|
|
||||||
if (test.Part == 0)
|
|
||||||
title = test.Name; /// Single test
|
|
||||||
else
|
|
||||||
title = string.Format("{0} ({1})", test.Name, test.Part); /// A part of a single test
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
title = string.Format("{0} ({1}/{2})", test.Name, 1, test.Repeats); /// More test repetitions
|
|
||||||
}
|
|
||||||
|
|
||||||
testComboBox.Text = title;
|
|
||||||
TestName = title;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
///
|
///
|
||||||
/// Copyright (c) 2013-2015 Senus Slovensko a.s.
|
/// Copyright (c) 2013-2021 Senus Slovensko a.s.
|
||||||
///
|
///
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
@ -29,28 +29,16 @@ namespace TBF.UI.Shared
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Selected;
|
public readonly string ComplTestName;
|
||||||
|
public readonly int TestId;
|
||||||
int testId;
|
public readonly int Part;
|
||||||
public int TestId { get { return testId; } }
|
public readonly int RepetitionNr;
|
||||||
|
|
||||||
string testName;
|
|
||||||
public string TestName { get { return testName; } }
|
|
||||||
|
|
||||||
int part;
|
|
||||||
public int Part { get { return part; } }
|
|
||||||
|
|
||||||
string title;
|
|
||||||
public string Title2 { get { return title; } }
|
|
||||||
|
|
||||||
int repetitionNr;
|
|
||||||
public int RepetitionNr { get { return repetitionNr; } }
|
|
||||||
|
|
||||||
public string Title { set { testNameLabel.Text = value; } }
|
|
||||||
|
|
||||||
public int Progress { set { testProgressBar.Value = value; } }
|
public int Progress { set { testProgressBar.Value = value; } }
|
||||||
public ProgressBar TestProgressBar { get { return testProgressBar; } }
|
public ProgressBar TestProgressBar { get { return testProgressBar; } }
|
||||||
|
|
||||||
|
public bool Selected;
|
||||||
|
|
||||||
public TestProgressCtrl()
|
public TestProgressCtrl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -58,15 +46,15 @@ namespace TBF.UI.Shared
|
|||||||
this.TestResult = TestProgressCtrl.Result.NotDone;
|
this.TestResult = TestProgressCtrl.Result.NotDone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestProgressCtrl(int testId, string testName, int part, string title, int repetitionNr, int testRepeats)
|
public TestProgressCtrl(string complTestName, int testId, int part, int repetitionNr)
|
||||||
: this()
|
: this()
|
||||||
{
|
{
|
||||||
this.testId = testId;
|
this.ComplTestName = complTestName;
|
||||||
this.part = part;
|
this.TestId = testId;
|
||||||
this.testName = testName;
|
this.Part = part;
|
||||||
this.title = title;
|
this.RepetitionNr = repetitionNr;
|
||||||
this.repetitionNr = repetitionNr;
|
|
||||||
this.Title = title;
|
testNameLabel.Text = complTestName;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TestProgressCtrl_Click(object sender, System.EventArgs e)
|
private void TestProgressCtrl_Click(object sender, System.EventArgs e)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
///
|
///
|
||||||
/// Copyright (c) 2013-2015 Sensus Slovensko a.s.
|
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
|
||||||
///
|
///
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -19,7 +19,7 @@ namespace TBF.UI
|
|||||||
public TestProgressControls(Control parent)
|
public TestProgressControls(Control parent)
|
||||||
{
|
{
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
progresses = null;
|
progresses = new List<TestProgressCtrl>();
|
||||||
currentProgress = null;
|
currentProgress = null;
|
||||||
|
|
||||||
Bridge.ProcedureSelectedHandler += delegate(object sender, ProcedureSelectedEventArgs args)
|
Bridge.ProcedureSelectedHandler += delegate(object sender, ProcedureSelectedEventArgs args)
|
||||||
@ -67,78 +67,22 @@ namespace TBF.UI
|
|||||||
|
|
||||||
void ResetProgressBars(Config.Entities.Procedure procedure)
|
void ResetProgressBars(Config.Entities.Procedure procedure)
|
||||||
{
|
{
|
||||||
foreach (var test in procedure.Tests)
|
|
||||||
{
|
|
||||||
var component = TbfComponents.FindComponent(test.Method);
|
|
||||||
if (component != null)
|
|
||||||
{
|
|
||||||
test.IsOuterLoopStart = component is TBF.BenchControl.TestMethods.OuterLoop.Start.Component;
|
|
||||||
test.IsOuterLoopEnd = component is TBF.BenchControl.TestMethods.OuterLoop.End.Component;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
parent.SuspendLayout();
|
parent.SuspendLayout();
|
||||||
|
|
||||||
currentProgress = null;
|
currentProgress = null;
|
||||||
parent.Controls.Clear();
|
parent.Controls.Clear();
|
||||||
progresses = new List<TestProgressCtrl>();
|
progresses.Clear();
|
||||||
bool isOuterLoopMode = false;
|
|
||||||
int outerLoopRepeats = 0;
|
|
||||||
|
|
||||||
int i = 0;
|
if (procedure.GetTestInstances() == null)
|
||||||
while (i < procedure.Tests.Count)
|
|
||||||
{
|
{
|
||||||
Config.Entities.Test test = procedure.Tests[i++];
|
procedure.UpdateTestInstances(TBF.BenchControl.StateMachine.LoopStartNames, TBF.BenchControl.StateMachine.LoopEndNames, null);
|
||||||
|
|
||||||
if (!isOuterLoopMode && test.IsOuterLoopStart)
|
|
||||||
{
|
|
||||||
isOuterLoopMode = true;
|
|
||||||
outerLoopRepeats = (i < procedure.Tests.Count) ? procedure.Tests[i].Repeats : 1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else if (isOuterLoopMode && test.IsOuterLoopEnd)
|
|
||||||
{
|
|
||||||
isOuterLoopMode = false;
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int repeats = test.Repeats;
|
foreach (var ti in procedure.GetTestInstances())
|
||||||
int newI = i;
|
|
||||||
for (int r = 1; r <=repeats ; r++)
|
|
||||||
{
|
{
|
||||||
if (isOuterLoopMode)
|
var progress = new TestProgressCtrl(ti.Name, ti.Test.Id, ti.Test.Part, ti.Repetition);
|
||||||
{
|
|
||||||
int j = i - 1;
|
|
||||||
while (j < procedure.Tests.Count)
|
|
||||||
{
|
|
||||||
Config.Entities.Test test2 = procedure.Tests[j++];
|
|
||||||
|
|
||||||
if (test2.IsOuterLoopEnd)
|
|
||||||
{
|
|
||||||
if (r == repeats) newI = j;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
string test2Name = Results.Utils.GetTestName(test2.Name, test2.Repeats, r);
|
|
||||||
TestProgressCtrl progress =
|
|
||||||
new TestProgressCtrl(test2.Id, test2Name, test2.Part, test2.GetExpandedTestName(r), r, test2.Repeats);
|
|
||||||
progresses.Add(progress);
|
progresses.Add(progress);
|
||||||
parent.Controls.Add(progress);
|
parent.Controls.Add(progress);
|
||||||
Console.WriteLine(test2Name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string testName = Results.Utils.GetTestName(test.Name, test.Repeats, r);
|
|
||||||
TestProgressCtrl progress =
|
|
||||||
new TestProgressCtrl(test.Id, testName, test.Part, test.GetExpandedTestName(r), r, test.Repeats);
|
|
||||||
progresses.Add(progress);
|
|
||||||
parent.Controls.Add(progress);
|
|
||||||
Console.WriteLine(testName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
i = newI;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
parent.ResumeLayout();
|
parent.ResumeLayout();
|
||||||
@ -177,7 +121,7 @@ namespace TBF.UI
|
|||||||
{
|
{
|
||||||
foreach (var prgrs in progresses)
|
foreach (var prgrs in progresses)
|
||||||
{
|
{
|
||||||
if (prgrs.TestName == args.TestName && prgrs.Part == args.Part)
|
if (prgrs.ComplTestName == args.TestName && prgrs.Part == args.Part && prgrs.RepetitionNr == args.RepetitionNr)
|
||||||
{
|
{
|
||||||
prgrs.Progress = args.Progress;
|
prgrs.Progress = args.Progress;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user