{"id":25453536,"url":"https://github.com/xcessentials/testing","last_synced_at":"2025-06-14T02:04:55.018Z","repository":{"id":56927807,"uuid":"84765179","full_name":"XCEssentials/Testing","owner":"XCEssentials","description":"[DEPRECATED - use 'nschum/SwiftHamcrest' instead] A more expressive and readable way to describe expectations in Xcode unit tests.","archived":false,"fork":false,"pushed_at":"2019-07-15T18:03:29.000Z","size":114,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-14T02:04:11.140Z","etag":null,"topics":["requirements","swift","xcode","xctest"],"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/XCEssentials.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}},"created_at":"2017-03-12T23:30:52.000Z","updated_at":"2019-07-15T18:01:23.000Z","dependencies_parsed_at":"2022-08-20T23:30:48.263Z","dependency_job_id":null,"html_url":"https://github.com/XCEssentials/Testing","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/XCEssentials/Testing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XCEssentials%2FTesting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XCEssentials%2FTesting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XCEssentials%2FTesting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XCEssentials%2FTesting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/XCEssentials","download_url":"https://codeload.github.com/XCEssentials/Testing/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XCEssentials%2FTesting/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259747215,"owners_count":22905310,"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","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":["requirements","swift","xcode","xctest"],"created_at":"2025-02-17T23:55:58.089Z","updated_at":"2025-06-14T02:04:54.992Z","avatar_url":"https://github.com/XCEssentials.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![license](https://img.shields.io/github/license/XCEssentials/Testing.svg)](https://opensource.org/licenses/MIT)\n[![GitHub tag](https://img.shields.io/github/tag/XCEssentials/Testing.svg)](https://cocoapods.org/?q=XCERequirement)\n[![CocoaPods](https://img.shields.io/cocoapods/v/XCETesting.svg)](https://cocoapods.org/?q=XCERequirement)\n[![CocoaPods](https://img.shields.io/cocoapods/p/XCETesting.svg)](https://cocoapods.org/?q=XCEUniFlow)\n\n\n# Problem\n\nEvery unit test represents one or several [requirements](https://en.wikipedia.org/wiki/Requirement). Standard Xcode API (XCTest framework) provides very basic expressions that work well, but the result code is not very concise and easy to read/understand.\n\n# Wishlist\n\n1. make the result code concise and self-expressive;\n2. allow to express requirement as closure (so it can consist of single value, expression or multiple expressions);\n3. allow to return value from a check.\n\n# How to install\n\nThe recommended way is to install using [CocoaPods](https://cocoapods.org/?q=XCETesting).\n\n# How it works\n\nThe library provides number of helper functions, each of these functions accept requirement description and closure, that returns the value that will be evaluated (and returned for some functions).\n\n# How to use\n\nWhen you have an `Optional` value or you have a function/closure that produces `Optional` value, and you need this value only if it's NOT `nil`, or call `XCTFail` otherwise:\n\n```swift\nlet nonNilValue = try RXC.value(\"Value is NOT nil\") {\n\t\n\t// return here an optional value,\n\t// it might be result of an expression \n\t// or an optional value captured from the outer scope,\n\t// will call 'XCTFail' if value IS 'nil' or just return\n\t// non-Optional value overwise\n}\n```\n\nSame as the above, but does not return a anything. When you have an `Optional` value or you have a function/closure that produces `Optional` value, and you need to make sure that this value is NOT `nil`, or call `XCTFail` otherwise:\n\n```swift\ntry RXC.isNotNil(\"Value is NOT nil\") { // does not return anything\n\t\n\t// return here an optional value,\n\t// it might be result of an expression \n\t// or an optional value captured from the outer scope,\n\t// will call 'XCTFail' if value IS 'nil' or pass through\n\t// silently otherwise\n}\n```\n\nWhen you have an `Optional` value or you have a function/closure that produces `Optional` value, and you need to make sure that this value IS `nil`, or call `XCTFail` otherwise:\n\n```swift\ntry RXC.isNil(\"Value IS nil\") { // does not return anything\n\t\n\t// return here an optional value,\n\t// it might be result of an expression \n\t// or an optional value captured from the outer scope,\n\t// will call 'XCTFail' if value is NOT 'nil' or pass through\n\t// silently otherwise\n}\n```\n\nWhen you have an `Bool` value or you have a function/closure that produces `Bool` value, and you want to continue only if it's `true`, or call `XCTFail` otherwise (if it's `false`):\n\n```swift\ntry RXC.isTrue(\"Value is TRUE\") { // does not return anything\n\t\n\t// return here a boolean value,\n\t// it might be result of an expression \n\t// or an boolean value captured from the outer scope,\n\t// will call 'XCTFail' if value is 'false' or pass through\n\t// silently otherwise\n}\n```\n\nThe `VerificationFailed` data type has the only parameter:\n\n- `let description: String` that contains the requirement description passed to the corresponding `RXC.*` function.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxcessentials%2Ftesting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxcessentials%2Ftesting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxcessentials%2Ftesting/lists"}