From 7f3abc6aff4ab3f03d205f13686dd64dd4d51e11 Mon Sep 17 00:00:00 2001 From: Boris Lysikov Date: Wed, 13 Nov 2024 21:50:59 +0700 Subject: [PATCH] add --- SwiftRadioUITests/Extensions/XCTest+Allure.swift | 16 ++++++++++++++++ SwiftRadioUITests/Tests/CommonTest.swift | 16 ++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/SwiftRadioUITests/Extensions/XCTest+Allure.swift b/SwiftRadioUITests/Extensions/XCTest+Allure.swift index 84bf50c..6227d29 100644 --- a/SwiftRadioUITests/Extensions/XCTest+Allure.swift +++ b/SwiftRadioUITests/Extensions/XCTest+Allure.swift @@ -40,5 +40,21 @@ public extension XCTest { } return self } + + @discardableResult + func before(_ name: String, step: () -> Void) -> XCTest { + XCTContext.runActivity(named: "befores: " + name) { _ in + step() + } + return self + } + + @discardableResult + func after(_ name: String, step: () -> Void) -> XCTest { + XCTContext.runActivity(named: "afters: " + name) { _ in + step() + } + return self + } } diff --git a/SwiftRadioUITests/Tests/CommonTest.swift b/SwiftRadioUITests/Tests/CommonTest.swift index d26207d..2c8c0b8 100644 --- a/SwiftRadioUITests/Tests/CommonTest.swift +++ b/SwiftRadioUITests/Tests/CommonTest.swift @@ -11,13 +11,17 @@ import XCTest class CommonTest: XCTestCase { override func setUp() { - super.setUp() - - continueAfterFailure = false - XCUIApplication().launch() + before("Иницилизация приложения") { + super.setUp() + + continueAfterFailure = false + XCUIApplication().launch() + } } - override class func tearDown() { - super.tearDown() + override func tearDown() { + after("Очистка состояния") { + super.tearDown() + } } }