{"id":28540038,"url":"https://github.com/wezsietato/datadriventesting","last_synced_at":"2025-09-16T16:48:47.013Z","repository":{"id":65742122,"uuid":"591449857","full_name":"WezSieTato/DataDrivenTesting","owner":"WezSieTato","description":"A Swift package that provides data-driven testing functionality for your project.","archived":false,"fork":false,"pushed_at":"2025-08-11T13:01:16.000Z","size":145,"stargazers_count":2,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-10T23:55:44.072Z","etag":null,"topics":["data-driven-tests","swift","swift-package","unit-testing"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WezSieTato.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-01-20T19:38:14.000Z","updated_at":"2023-02-08T10:53:41.000Z","dependencies_parsed_at":"2023-11-11T11:23:30.033Z","dependency_job_id":"a097c572-854f-4fd6-aa15-d41073d32da9","html_url":"https://github.com/WezSieTato/DataDrivenTesting","commit_stats":{"total_commits":24,"total_committers":2,"mean_commits":12.0,"dds":0.25,"last_synced_commit":"8facbcd080a2087b1059aa0b6156e34240b6af8c"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/WezSieTato/DataDrivenTesting","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WezSieTato%2FDataDrivenTesting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WezSieTato%2FDataDrivenTesting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WezSieTato%2FDataDrivenTesting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WezSieTato%2FDataDrivenTesting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WezSieTato","download_url":"https://codeload.github.com/WezSieTato/DataDrivenTesting/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WezSieTato%2FDataDrivenTesting/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275454102,"owners_count":25467901,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-16T02:00:10.229Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-driven-tests","swift","swift-package","unit-testing"],"created_at":"2025-06-09T19:07:55.214Z","updated_at":"2025-09-16T16:48:47.004Z","avatar_url":"https://github.com/WezSieTato.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DataDrivenTesting\n\nA Swift package that provides data-driven testing functionality for your project.\n\n[![](https://img.shields.io/endpoint?url=https://swiftpackageindex.com/api/packages/WezSieTato/DataDrivenTesting/badge?type=swift-versions)](https://swiftpackageindex.com/WezSieTato/DataDrivenTesting)\n[![](https://img.shields.io/endpoint?url=https://swiftpackageindex.com/api/packages/WezSieTato/DataDrivenTesting/badge?type=platforms)](https://swiftpackageindex.com/WezSieTato/DataDrivenTesting)\n[![Tests](https://github.com/WezSieTato/DataDrivenTesting/actions/workflows/tests.yml/badge.svg)](https://github.com/WezSieTato/DataDrivenTesting/actions/workflows/tests.yml)\n[![Lint](https://github.com/WezSieTato/DataDrivenTesting/actions/workflows/lint.yml/badge.svg)](https://github.com/WezSieTato/DataDrivenTesting/actions/workflows/lint.yml)\n[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/DataDrivenTesting.svg)](https://img.shields.io/cocoapods/v/DataDrivenTesting.svg)\n\n\n## Usage\n\nTo run a test with data-driven testing, you just need to run `dataTests` method on your test case:\n\n```swift\n@testable import DataDrivenTesting\nimport XCTest\n\nfinal class DataDrivenTests: XCTestCase {\n    func testDescriptionFromInteger() {\n        dataTests([\n            TestData((input: 1, expected: \"1\")),\n            TestData((input: 2, expected: \"2\")),\n        ]) { testData, _ in\n            let result = testData.data.input.description\n\n            XCTAssertEqual(result, testData.data.expected, file: testData.file, line: testData.line)\n        }\n    }\n}\n```\n\nThis will run the test for each data from array using passed closure. To get more readable test results, you can check Report Navigator in Xcode. It will show you all test cases with data that was used to run them.\n\n![Report Navigator with default activity name](images/report_navigator_default.png)\n\nPassing file and line parameters to `XCTAssertEqual` is optional, but it will help you to find the failing test case in the code.\n\n![Failing test](images/failing_test.png)\n\nYou can also change default activity name by passing name as a second parameter to `TestData` struct:\n\n```swift\n    func testSumOfInt() {\n        dataTests([\n            .init(([], 0), name: \"Empty array\"),\n            .init(([1], 1), name: \"One value in array\"),\n            .init(([2,3], 5), name: \"Two values in array\"),\n\n        ]) { testData, activity in\n            let result = testData.data.0.reduce(0, +)\n\n            XCTAssertEqual(result, testData.data.1, file: testData.file, line: testData.line)\n        }\n    }\n```\n\nWhich will result in Report Navigator like this:\n\n![Report Navigator with custom activity name](images/report_navigator_custom.png)\n\nIf you need add any attachments to your test case, you can use `XCTActivity` parameter in closure:\n\n```swift\n    private struct CEO: Encodable {\n        let firstName: String\n        let lastName: String\n    }\n\n    func testUsingActivity() {\n        dataTests([\n            TestData(CEO(firstName: \"Steve\", lastName: \"Jobs\")),\n            TestData(CEO(firstName: \"Tim\", lastName: \"Cook\")),\n        ]) { testData, activity in\n            let json = try! JSONEncoder().encode(testData.data)\n\n            let attachment = XCTAttachment(data: json)\n            attachment.lifetime = .keepAlways\n            activity.add(attachment)\n        }\n    }\n```\n## Requirements\n\n* Swift 5.4+\n* Xcode 9.0+\n\n## Installation\n\n### Xcode\n\n\u003e ⚠️ Warning: By default, Xcode will try to add the DataDrivenTesting package to your project's main application/framework target. Please ensure that DataDrivenTesting is added to a _test_ target instead, as documented in the last step, below.\n\n 1. From the **File** menu, navigate through **Swift Packages** and select **Add Package Dependency…**.\n 2. Enter package repository URL: `https://github.com/WezSieTato/DataDrivenTesting`\n 3. Confirm the version and let Xcode resolve the package\n 4. On the final dialog, update DataDrivenTesting's **Add to Target** column to a test target that will contain data tests (if you have more than one test target, you can later add DataDrivenTesting to them by manually linking the library in its build phase)\n\n### Swift Package Manager\n\nIf you want to use DataDrivenTesting in any other project that uses [SwiftPM](https://swift.org/package-manager/), add the package as a dependency in `Package.swift`:\n\n```swift\ndependencies: [\n  .package(\n    url: \"https://github.com/WezSieTato/DataDrivenTesting\",\n    from: \"1.0.0\"\n  ),\n]\n```\n\nNext, add `DataDrivenTesting` as a dependency of your test target:\n\n```swift\ntargets: [\n  .target(name: \"MyApp\"),\n  .testTarget(\n    name: \"MyAppTests\",\n    dependencies: [\n      \"MyApp\",\n      .product(name: \"DataDrivenTesting\", package: \"DataDrivenTesting\"),\n    ]\n  )\n]\n```\n\n### CocoaPods\n\nIf you want to use DataDrivenTesting in any other project that uses [CocoaPods](https://cocoapods.org/), add the package as a dependency in `Podfile`:\n\n```ruby\npod 'DataDrivenTesting', '~\u003e 1.0'\n```\n\n## License\n\nThis library is released under the MIT license. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwezsietato%2Fdatadriventesting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwezsietato%2Fdatadriventesting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwezsietato%2Fdatadriventesting/lists"}