Skip to content

Commit

Permalink
Merge pull request #75 from Tyler-Keith-Thompson/fix-test-discovery
Browse files Browse the repository at this point in the history
Fix test discovery
  • Loading branch information
Tyler-Keith-Thompson authored Feb 4, 2023
2 parents b7866ef + 3b11df3 commit 3b9d262
Show file tree
Hide file tree
Showing 15 changed files with 14 additions and 161 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/PR_CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
fail_ci_if_error: false

build_for_package_managers:
needs: test
Expand Down
2 changes: 1 addition & 1 deletion CucumberSwift.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'CucumberSwift'
s.version = '3.3.26'
s.version = '4.0.0'
s.summary = 'A lightweight swift only cucumber implementation.'

s.description = <<-DESC
Expand Down
36 changes: 0 additions & 36 deletions CucumberSwift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
objects = {

/* Begin PBXBuildFile section */
1D1648DB245A7549000CA612 /* XCTestHooks.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D1648DA245A7549000CA612 /* XCTestHooks.m */; };
1DA7619923933BCB001CBA5B /* RunWithLineNumberTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1DA7619823933BCB001CBA5B /* RunWithLineNumberTests.swift */; };
1DA7619B23933F18001CBA5B /* Positionable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1DA7619A23933F18001CBA5B /* Positionable.swift */; };
1DA7619D2393C5AB001CBA5B /* DocString.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1DA7619C2393C5AB001CBA5B /* DocString.swift */; };
Expand Down Expand Up @@ -52,7 +51,6 @@
AD9E15CD21176FC500FB5B6C /* StringReaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD9E15CC21176FC500FB5B6C /* StringReaderTests.swift */; };
AD9EB46A2079CF87002494C0 /* CucumberSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AD9EB4602079CF87002494C0 /* CucumberSwift.framework */; };
AD9EB46F2079CF87002494C0 /* CucumberSwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD9EB46E2079CF87002494C0 /* CucumberSwiftTests.swift */; };
AD9EB4712079CF87002494C0 /* CucumberSwift.h in Headers */ = {isa = PBXBuildFile; fileRef = AD9EB4632079CF87002494C0 /* CucumberSwift.h */; settings = {ATTRIBUTES = (Public, ); }; };
AD9EB47B2079CFA1002494C0 /* Cucumber.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD9EB47A2079CFA1002494C0 /* Cucumber.swift */; };
AD9EB47D2079D280002494C0 /* Feature.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD9EB47C2079D280002494C0 /* Feature.swift */; };
AD9EB47F2079D28E002494C0 /* Step.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD9EB47E2079D28E002494C0 /* Step.swift */; };
Expand Down Expand Up @@ -112,9 +110,6 @@
CAB20B3E24CCF6B20024C703 /* DSLRuleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAB20B3D24CCF6B20024C703 /* DSLRuleTests.swift */; };
CADD26DD265B1D1F00EE8707 /* JSONReporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = CADD26DC265B1D1F00EE8707 /* JSONReporter.swift */; };
CAEE41EE28B324BF000D4703 /* CucumberSwiftExpressions in Frameworks */ = {isa = PBXBuildFile; productRef = CAEE41ED28B324BF000D4703 /* CucumberSwiftExpressions */; };
CAF51ED2255874D20095A5C4 /* XCTestHooks.h in Headers */ = {isa = PBXBuildFile; fileRef = CAF51EC5255873E90095A5C4 /* XCTestHooks.h */; settings = {ATTRIBUTES = (Public, ); }; };
CAF51ED9255877FC0095A5C4 /* NSObjectLoadable.m in Sources */ = {isa = PBXBuildFile; fileRef = CAF51ED8255877FC0095A5C4 /* NSObjectLoadable.m */; };
CAF51EE2255878C80095A5C4 /* NSObjectLoadable.h in Headers */ = {isa = PBXBuildFile; fileRef = CAF51ED7255877ED0095A5C4 /* NSObjectLoadable.h */; settings = {ATTRIBUTES = (Public, ); }; };
CAF87A55281453EF00F7946A /* CucumberSwift.docc in Sources */ = {isa = PBXBuildFile; fileRef = CAF87A54281453EF00F7946A /* CucumberSwift.docc */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -143,7 +138,6 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
1D1648DA245A7549000CA612 /* XCTestHooks.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XCTestHooks.m; sourceTree = "<group>"; };
1DA7619823933BCB001CBA5B /* RunWithLineNumberTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunWithLineNumberTests.swift; sourceTree = "<group>"; };
1DA7619A23933F18001CBA5B /* Positionable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Positionable.swift; sourceTree = "<group>"; };
1DA7619C2393C5AB001CBA5B /* DocString.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DocString.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -186,7 +180,6 @@
AD9E15CA21176F8D00FB5B6C /* StringReader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringReader.swift; sourceTree = "<group>"; };
AD9E15CC21176FC500FB5B6C /* StringReaderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringReaderTests.swift; sourceTree = "<group>"; };
AD9EB4602079CF87002494C0 /* CucumberSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CucumberSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };
AD9EB4632079CF87002494C0 /* CucumberSwift.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CucumberSwift.h; sourceTree = "<group>"; };
AD9EB4642079CF87002494C0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
AD9EB4692079CF87002494C0 /* CucumberSwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CucumberSwiftTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
AD9EB46E2079CF87002494C0 /* CucumberSwiftTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CucumberSwiftTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -252,9 +245,6 @@
CABED02C256A17F2001E92C1 /* CucumberSwift.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = CucumberSwift.xctestplan; sourceTree = "<group>"; };
CADD26DC265B1D1F00EE8707 /* JSONReporter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSONReporter.swift; sourceTree = "<group>"; };
CAF51EA42557B1C70095A5C4 /* Package.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = SOURCE_ROOT; };
CAF51EC5255873E90095A5C4 /* XCTestHooks.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XCTestHooks.h; sourceTree = "<group>"; };
CAF51ED7255877ED0095A5C4 /* NSObjectLoadable.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSObjectLoadable.h; sourceTree = "<group>"; };
CAF51ED8255877FC0095A5C4 /* NSObjectLoadable.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSObjectLoadable.m; sourceTree = "<group>"; };
CAF87A54281453EF00F7946A /* CucumberSwift.docc */ = {isa = PBXFileReference; lastKnownFileType = folder.documentationcatalog; path = CucumberSwift.docc; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -397,7 +387,6 @@
AD9EB4622079CF87002494C0 /* Sources */ = {
isa = PBXGroup;
children = (
CAF51EEB25587AFC0095A5C4 /* Obj-C BS */,
CAF51EAE2557B35C0095A5C4 /* CucumberSwift */,
CAF51EA42557B1C70095A5C4 /* Package.swift */,
);
Expand Down Expand Up @@ -639,42 +628,19 @@
CA5A7C3720FC2B0A00F4564A /* Extensions */,
CA5A7C3620FC2AF600F4564A /* Gherkin */,
CA612FAD24CD298D00A7BBCD /* Generated */,
AD9EB4632079CF87002494C0 /* CucumberSwift.h */,
AD9EB4642079CF87002494C0 /* Info.plist */,
AD73CEF72222ECD8002BF7C0 /* TestingExtensions.swift */,
);
path = CucumberSwift;
sourceTree = "<group>";
};
CAF51EEB25587AFC0095A5C4 /* Obj-C BS */ = {
isa = PBXGroup;
children = (
1D1648DA245A7549000CA612 /* XCTestHooks.m */,
CAF51ED8255877FC0095A5C4 /* NSObjectLoadable.m */,
CAF51EEC25587B4C0095A5C4 /* Include */,
);
path = "Obj-C BS";
sourceTree = "<group>";
};
CAF51EEC25587B4C0095A5C4 /* Include */ = {
isa = PBXGroup;
children = (
CAF51EC5255873E90095A5C4 /* XCTestHooks.h */,
CAF51ED7255877ED0095A5C4 /* NSObjectLoadable.h */,
);
path = Include;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXHeadersBuildPhase section */
AD9EB45D2079CF87002494C0 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
AD9EB4712079CF87002494C0 /* CucumberSwift.h in Headers */,
CAF51ED2255874D20095A5C4 /* XCTestHooks.h in Headers */,
CAF51EE2255878C80095A5C4 /* NSObjectLoadable.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -919,7 +885,6 @@
CA1C47F32634C6D9008D8E12 /* FeatureHook.swift in Sources */,
AD017234211671D200FBC9AF /* Method.swift in Sources */,
ADAA738E20A9356000D2344C /* CollectionExtensions.swift in Sources */,
CAF51ED9255877FC0095A5C4 /* NSObjectLoadable.m in Sources */,
1DA761A2239A7A74001CBA5B /* ASTToken.swift in Sources */,
AD9EB47B2079CFA1002494C0 /* Cucumber.swift in Sources */,
AD9EB4832079D606002494C0 /* Scenario.swift in Sources */,
Expand All @@ -945,7 +910,6 @@
AD9EB47F2079D28E002494C0 /* Step.swift in Sources */,
5AE2C0C120FEA958000DDD48 /* ScenarioOutlineParser.swift in Sources */,
CA097281264F4D5100573DA5 /* CucumberTestObserver.swift in Sources */,
1D1648DB245A7549000CA612 /* XCTestHooks.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
11 changes: 2 additions & 9 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let package = Package(
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "CucumberSwift",
targets: ["CucumberSwift_ObjC", "CucumberSwift"])
targets: ["CucumberSwift"])
],
dependencies: [
.package(url: "https://github.com/Tyler-Keith-Thompson/CucumberSwiftExpressions.git", from: "0.0.8"),
Expand All @@ -19,17 +19,10 @@ let package = Package(
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "CucumberSwift_ObjC",
dependencies: [],
path: "Sources/Obj-C BS",
exclude: ["Gherkin/XCode-Specific"], // SPM shouldn't vend the syntax highlighting files
publicHeadersPath: "Include"),
.target(
name: "CucumberSwift",
dependencies: [
"CucumberSwiftExpressions",
"CucumberSwift_ObjC"
"CucumberSwiftExpressions"
],
path: "Sources/CucumberSwift",
exclude: ["Info.plist"],
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ CucumberSwift is a lightweight Swift only Cucumber implementation for iOS, tvOS,

NOTE: WatchOS support coming soon!

* [Installation](https://github.com/Tyler-Keith-Thompson/CucumberSwift/wiki/installation)
* [Getting Started](https://github.com/Tyler-Keith-Thompson/CucumberSwift/wiki)
* [Docs](https://tyler-keith-thompson.github.io/CucumberSwift/documentation/cucumberswift/)
* [Getting Started](https://tyler-keith-thompson.github.io/CucumberSwift/tutorials/tutorial-table-of-contents/)
* [XCTest Integration](https://github.com/Tyler-Keith-Thompson/CucumberSwift/wiki/xctest-integration)

* [Contributing](/CONTRIBUTING.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import CucumberSwift

extension Cucumber: StepImplementation {
public var bundle: Bundle {
class Findme { }
return Bundle(for: Findme.self) //This is just my shortcut way of identifying the test bundle, you do you. This bundle needs to contain the folder reference we added
class TestExplorer: CucumberTest { } // !! Make sure to inherit from CucumberTest
return Bundle(for: TestExplorer.self) // !! Important, this is what allows Cucumber Tests to be discovered.
}

public func setupSteps() {
Expand Down
17 changes: 0 additions & 17 deletions Sources/CucumberSwift/CucumberSwift.h

This file was deleted.

15 changes: 2 additions & 13 deletions Sources/CucumberSwift/Runner/Cucumber.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,8 @@ import Foundation
import XCTest
import CucumberSwiftExpressions

#if canImport(CucumberSwift_ObjC)
import CucumberSwift_ObjC
#endif

@objc public class Cucumber: NSObject {
static var shared: Cucumber = {
Cucumber()
}()
static var shared = Cucumber()

var features = [Feature]()
var currentStep: Step?
Expand Down Expand Up @@ -83,6 +77,7 @@ import CucumberSwift_ObjC
override public init() {
super.init()
XCTestObservationCenter.shared.addTestObserver(self)
print("INIT CALLED")
}

init(withString string: String) {
Expand Down Expand Up @@ -273,9 +268,3 @@ import CucumberSwift_ObjC
}
}
}

@nonobjc extension XCTestCase {
@objc override public class func beforeParallelization() {
Cucumber.Load()
}
}
2 changes: 1 addition & 1 deletion Sources/CucumberSwift/Runner/CucumberTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation
import XCTest

public final class CucumberTest: XCTestCase {
open class CucumberTest: XCTestCase {
override public class var defaultTestSuite: XCTestSuite {
Cucumber.shared.reporters.forEach { $0.testSuiteStarted(at: Date()) }

Expand Down
19 changes: 0 additions & 19 deletions Sources/Obj-C BS/Include/NSObjectLoadable.h

This file was deleted.

17 changes: 0 additions & 17 deletions Sources/Obj-C BS/Include/XCTestHooks.h

This file was deleted.

18 changes: 0 additions & 18 deletions Sources/Obj-C BS/NSObjectLoadable.m

This file was deleted.

20 changes: 0 additions & 20 deletions Sources/Obj-C BS/XCTestHooks.m

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,8 @@ extension CucumberTest {

extension Cucumber: StepImplementation {
public var bundle: Bundle {
#if canImport(CucumberSwift_ObjC)
return Bundle(url: Bundle.module.bundleURL.deletingLastPathComponent().appendingPathComponent("CucumberSwift_CucumberSwiftConsumerTests.bundle"))!
#else
return Bundle(for: Me.self)
#endif
class TestDiscovery: CucumberTest { }
return Bundle(for: TestDiscovery.self)
}

public func setupSteps() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import Foundation
import XCTest
@testable import CucumberSwift

extension Cucumber {
Expand Down

0 comments on commit 3b9d262

Please sign in to comment.