Skip to content

Commit 166da97

Browse files
committed
Fixing an issue where TestData was not properly reset between different test runs, so tests accidentally passed due to uncleared state of test before
1 parent 4053ac9 commit 166da97

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

RobotRuntime/Execution/Runners/NestedCommandRunner.cs

-3
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ public void Run(IRunnable runnable)
5555
TestData.ShouldFailTest = true;
5656
return;
5757
}
58-
59-
if (TestData.ShouldPassTest)
60-
return;
6158
}
6259

6360

RobotRuntime/MouseRobot/TestRunner.cs

+11-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ public void LoadSettings()
5454
private void InitializeNewRun()
5555
{
5656
TestRunStart?.Invoke();
57-
TestData.ShouldCancelRun = false;
58-
TestData.ShouldFailTest = false;
57+
ResetTestData(TestData);
5958

6059
AssetGuidManager.LoadMetaFiles();
6160
RuntimeAssetManager.CollectAllImporters();
@@ -77,6 +76,7 @@ public Task StartRecording(LightRecording lightRecording)
7776
{
7877
InitializeNewRun();
7978

79+
ResetTestData(TestData);
8080
TestData.TestFixture = lightRecording;
8181
RunnerFactory.PassDependencies(TestData);
8282

@@ -91,6 +91,13 @@ public Task StartRecording(LightRecording lightRecording)
9191
});
9292
}
9393

94+
private void ResetTestData(TestData testData)
95+
{
96+
testData.ShouldPassTest = false;
97+
testData.ShouldFailTest = false;
98+
testData.ShouldCancelRun = false;
99+
}
100+
94101
/// <summary>
95102
/// Runs all tests from all test fixtures.
96103
/// Accepts Regex filter for fixture and test names.
@@ -131,6 +138,8 @@ await Task.Run(() =>
131138

132139
foreach (var test in fixture.Tests)
133140
{
141+
ResetTestData(TestData);
142+
134143
var testMathesFilter = Regex.IsMatch(fixture.Name + "." + test.Name, testFilter, RegexOptions.IgnoreCase);
135144
if (!fixtureMathesFilter && !testMathesFilter)
136145
continue;

0 commit comments

Comments
 (0)