Skip to content

Commit

Permalink
POC: Featurevisor Swift Test Runner (#65)
Browse files Browse the repository at this point in the history
* Add new executable target
* Add support for setting up bucket value based on "at" + tweaks with variable values mapping
* Be more elastic and run tests against Apple env like ios and tvos
* Add "commands" dependency to run script command to generate datafiles via featurevisor cli
* Update README with information on how test runner can be used
  • Loading branch information
polok authored Mar 5, 2024
1 parent 52f4672 commit 4d91882
Show file tree
Hide file tree
Showing 17 changed files with 986 additions and 67 deletions.
111 changes: 64 additions & 47 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,53 +1,70 @@
// swift-tools-version:5.5
// swift-tools-version:5.7
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "FeaturevisorSDK",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "FeaturevisorSDK",
targets: ["FeaturevisorSDK"]
),
.library(
name: "FeaturevisorTypes",
targets: ["FeaturevisorTypes"]
),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/daisuke-t-jp/MurmurHash-Swift.git", from: "1.1.1"),
],
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 which this package depends on.
.target(
name: "FeaturevisorTypes",
dependencies: []
),
.target(
name: "FeaturevisorSDK",
dependencies: [
"FeaturevisorTypes",
"MurmurHash-Swift"
]
),
.testTarget(
name: "FeaturevisorSDKTests",
dependencies: [
"FeaturevisorSDK"
]
),
.testTarget(
name: "FeaturevisorTypesTests",
dependencies: [
"FeaturevisorTypes"
],
resources: [
.process("JSONs")
]),
]
name: "FeaturevisorSDK",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "FeaturevisorSDK",
targets: ["FeaturevisorSDK"]
),
.library(
name: "FeaturevisorTypes",
targets: ["FeaturevisorTypes"]
),
.executable(
name: "FeaturevisorSwiftTestRunner",
targets: ["FeaturevisorTestRunner"]
),
],
dependencies: [
.package(url: "https://github.com/daisuke-t-jp/MurmurHash-Swift.git", from: "1.1.1"),
.package(url: "https://github.com/JohnSundell/Files", from: "4.0.0"),
.package(url: "https://github.com/jpsim/Yams.git", from: "5.0.6"),
.package(url: "https://github.com/qiuzhifei/swift-commands", from: "0.6.0"),
],
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 which this package depends on.
.target(
name: "FeaturevisorTypes",
dependencies: []
),
.target(
name: "FeaturevisorSDK",
dependencies: [
"FeaturevisorTypes",
"MurmurHash-Swift",
]
),
.executableTarget(
name: "FeaturevisorTestRunner",
dependencies: [
"FeaturevisorSDK",
"FeaturevisorTypes",
"Files",
"Yams",
.product(name: "Commands", package: "swift-commands"),
],
path: "Sources/FeaturevisorTestRunner"
),
.testTarget(
name: "FeaturevisorSDKTests",
dependencies: [
"FeaturevisorSDK"
]
),
.testTarget(
name: "FeaturevisorTypesTests",
dependencies: [
"FeaturevisorTypes"
],
resources: [
.process("JSONs")
]
),
]
)
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,15 +320,22 @@ let f = try createInstance(options: options)

### Test runner

@TODO: ...

We should also have an executable as an output of this repository that can be used to run the test specs against the Swift SDK: https://featurevisor.com/docs/testing/
@TODO: Work still in progress. Currently we have an early POC.

Example command:

First you need to install the Swift Test Runner using above steps (until we release official version)
```
$ cd path/to/featurevisor-swift-sdk
$ swift build -c release
$ cd .build/release
$ cp -f FeaturevisorSwiftTestRunner /usr/local/bin/featurevisor-swift-test-runner
```

Now you can usage like below:
```
$ cd path/to/featurevisor-project-with-yamls
$ featurevisor-swift test
$ featurevisor-swift-test-runner .
```

## License
Expand Down
Loading

0 comments on commit 4d91882

Please sign in to comment.