public override void TearDown() { _allure.UpdateTestCase(test => { var packageName = TestContext.CurrentContext.Test.ClassName; var className = packageName.Substring(packageName.LastIndexOf('.') + 1); test.labels.AddRange(new List <Label> { Label.Suite(TestRunner.FeatureContext?.FeatureInfo.Title.Trim()), Label.Feature(TestRunner.FeatureContext?.FeatureInfo.Title), Label.TestClass(className), Label.Package(packageName) }); if (Driver != null) { test.labels.Add(Label.ParentSuite(BrowserName)); try { test.parameters.Add(new Parameter { name = "Screen", value = string.Concat(Driver.Manage().Window.Size.Width, "x", Driver.Manage().Window.Size.Height) }); } catch (Exception) { // } } else { test.labels.Add(Label.ParentSuite(test.statusDetails.message)); } if (TestRunner.ScenarioContext != null) { var tags = PluginHelper.GetTags(TestRunner.FeatureContext?.FeatureInfo, TestRunner.ScenarioContext?.ScenarioInfo); test.labels.Add(Label.SubSuite(TestRunner.ScenarioContext?.ScenarioInfo.Title)); test.labels.AddRange(tags.Item1); test.links = tags.Item2; } }); if (TestContext.CurrentContext.Result.Outcome.Status != TestStatus.Passed) { if (Driver != null) { try { var screen = ((ITakesScreenshot)Driver).GetScreenshot(); _allure.AddAttachment("ScreenShot", "image/png", screen.AsByteArray); } catch (Exception e) { _allure.UpdateTestCase(test => test.parameters.Add(new Parameter { name = "ScreenShotError", value = e.Message })); } } } else { _allure.UpdateTestCase(x => x.status = Status.passed); } _allure.StopTestCase(TestResultId); _allure.WriteTestCase(TestResultId); _allure.StartAfterFixture(TestContainerId, Guid.NewGuid().ToString(), new FixtureResult()); if (Driver != null) { if (Driver is PaidWebDriver driver) { _allure.WrapInStep(UpdateApi, $"Updating {driver.Name} results through API"); } _allure.WrapInStep(KillWebDriver, $"Killing {BrowserName}"); } _allure.StopFixture(fixture => { fixture.stage = Stage.finished; }); _allure.UpdateTestContainer(TestContainerId, testContainer => testContainer.stop = DateTimeOffset.Now.ToUnixTimeMilliseconds()); _allure.StopTestContainer(TestContainerId); _allure.WriteTestContainer(TestContainerId); }