protected override void PostTestCleanup(object sender, PluginEventArgs e) { if (!AreDynamicTestCasesEnabled()) { return; } base.PostTestCleanup(sender, e); try { // Update the test case only upon test pass. In case of failure, only the basic test case - name, description, etc will remain - without the test steps if (e.TestOutcome == TestOutcome.Passed && _dynamicTestCasesService?.Context != null) { _dynamicTestCasesService.Context.Value.TestCase = _testCaseManagementService.InitTestCase(_dynamicTestCasesService.Context.Value); } } catch (Exception ex) { Logger.LogError($"Test case failed to update, {ex.Message}"); } _dynamicTestCasesService?.ResetContext(); }