From 373b693082db4d3f4b33207b85e2a410428fa867 Mon Sep 17 00:00:00 2001 From: Tyler Thompson Date: Mon, 23 Apr 2018 13:46:00 -0600 Subject: [PATCH] Pretty print modified to show feature and scenario titles - TT --- CucumberSwift/Cucumber.swift | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/CucumberSwift/Cucumber.swift b/CucumberSwift/Cucumber.swift index 90e0c676..13ba9888 100644 --- a/CucumberSwift/Cucumber.swift +++ b/CucumberSwift/Cucumber.swift @@ -66,23 +66,27 @@ import XCTest public func executeFeatures() { for feature in features { - BeforeFeature?(feature) - for scenario in feature.scenarios { - BeforeScenario?(scenario) - for step in scenario.steps { - BeforeStep?(step) - currentStep = step - XCTContext.runActivity(named: "\(step.keyword?.rawValue ?? "") \(step.match)") { _ in - step.execute?(step.match.matches(for: step.regex)) - if (step.execute != nil && step.result != .failed) { - step.result = .passed + XCTContext.runActivity(named: "Feature: \(feature.title)") { _ in + BeforeFeature?(feature) + for scenario in feature.scenarios { + XCTContext.runActivity(named: "Scenario: \(scenario.title)") { _ in + BeforeScenario?(scenario) + for step in scenario.steps { + BeforeStep?(step) + currentStep = step + XCTContext.runActivity(named: "\(step.keyword?.rawValue ?? "") \(step.match)") { _ in + step.execute?(step.match.matches(for: step.regex)) + if (step.execute != nil && step.result != .failed) { + step.result = .passed + } + } + AfterStep?(step) } + AfterScenario?(scenario) } - AfterStep?(step) } - AfterScenario?(scenario) + AfterFeature?(feature) } - AfterFeature?(feature) } DispatchQueue.main.async { if let documentDirectory = try? FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor:nil, create:false),