{"id":19519027,"url":"https://github.com/bizz84/acceptancemark","last_synced_at":"2025-04-26T07:31:02.269Z","repository":{"id":136548611,"uuid":"65284877","full_name":"bizz84/AcceptanceMark","owner":"bizz84","description":"Tool for generating Acceptance Tests in Xcode, inspired by Fitnesse","archived":false,"fork":false,"pushed_at":"2019-05-09T18:04:32.000Z","size":121,"stargazers_count":65,"open_issues_count":11,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-26T06:02:28.190Z","etag":null,"topics":[],"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/bizz84.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-08-09T10:06:21.000Z","updated_at":"2024-04-02T17:42:44.000Z","dependencies_parsed_at":"2024-01-05T20:28:59.301Z","dependency_job_id":null,"html_url":"https://github.com/bizz84/AcceptanceMark","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bizz84%2FAcceptanceMark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bizz84%2FAcceptanceMark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bizz84%2FAcceptanceMark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bizz84%2FAcceptanceMark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bizz84","download_url":"https://codeload.github.com/bizz84/AcceptanceMark/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250953290,"owners_count":21513292,"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":[],"created_at":"2024-11-11T00:15:55.935Z","updated_at":"2025-04-26T07:31:01.894Z","avatar_url":"https://github.com/bizz84.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://github.com/bizz84/AcceptanceMark/raw/master/logo.png\"\u003e\n\n[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](http://mit-license.org)\n[![Language](http://img.shields.io/badge/language-swift-orange.svg?style=flat)](https://developer.apple.com/swift)\n[![Build](https://img.shields.io/travis/bizz84/AcceptanceMark.svg?style=flat)](https://travis-ci.org/bizz84/AcceptanceMark)\n[![Issues](https://img.shields.io/github/issues/bizz84/AcceptanceMark.svg?style=flat)](https://github.com/bizz84/AcceptanceMark/issues)\n[![Twitter](https://img.shields.io/badge/twitter-@biz84-blue.svg?maxAge=2592000)](http://twitter.com/biz84)\n\n#### AcceptanceMark is a tool for generating Acceptance Tests in Xcode, inspired by [Fitnesse](http://fitnesse.org/).\n\n#### [Read this blog post](http://bizz84.github.io/2016/09/21/Introducing-AcceptanceMark.html) for a full introduction to AcceptanceMark.\n\n### Fitnesse advantages\n\n* Easy to write business rules in tabular form in Markdown files.\n* All shareholders can write Fitnesse tests.\n* Convenient Test Report.\n\n### Fitnesse disadvantages\n\n* Does not integrate well with XCTest.\n* Requires to run a separate server.\n* Difficult to configure and run locally / on CI.\n\n### The solution: AcceptanceMark\n\nAcceptanceMark is the ideal tool to write Fitnesse-style acceptance tests that integrate seamlessly with XCTest:\n\n* Write your tests inputs and expected values in markdown tables.\n* AcceptanceMark generates XCTest test classes with **strong-typed input/outputs**. \n* Write test runners to evaluate the system under test with the given inputs.\n* Run the chosen test target (Unit Tests supported, UI Tests **will** be supported) and get a test report.\n\n## How does this work?\n\n#### Write your own test sets, like so:\n\n```\nimage-tests.md\n\n## Image Loading\n\n| name:String   || loaded:Bool  |\n| ------------- || ------------ |\n| available.png || true         |\n| missing.png   || false        |\n```\n\n#### Run **amtool** manually or as an Xcode pre-compilation phase:\n\n```\namtool -i image-tests.md\n```\n\nThis generates an `XCTestCase` test class:\n\n```swift\n/*\n * File Auto-Generated by AcceptanceMark - DO NOT EDIT\n * input file: ImageTests.md\n * generated file: ImageTests_ImageLoadingTests.swift\n *\n * -- Test Specification -- \n *\n * ## Image Loading\n * | name:String   || loaded:Bool  |\n * | ------------- || ------------ |\n * | available.png || true         |\n * | missing.png   || false        |\n */\n\n//// Don't forget to create a test runner: \n//\n//class ImageTests_ImageLoadingRunner: ImageTests_ImageLoadingRunnable {\n//\n//\tfunc run(input: ImageTests_ImageLoadingInput) throws -\u003e ImageTests_ImageLoadingOutput {\n//\t\treturn ImageTests_ImageLoadingOutput(\u003c#parameters#\u003e)\n//\t}\n//}\n\nimport XCTest\n\nstruct ImageTests_ImageLoadingInput {\n\tlet name: String\n}\n\nstruct ImageTests_ImageLoadingOutput: Equatable {\n\tlet loaded: Bool\n}\n\nprotocol ImageTests_ImageLoadingRunnable {\n\tfunc run(input: ImageTests_ImageLoadingInput) throws -\u003e ImageTests_ImageLoadingOutput\n}\nclass ImageTests_ImageLoadingTests: XCTestCase {\n\n\tvar testRunner: ImageTests_ImageLoadingRunnable!\n\n\toverride func setUp() {\n\t\t// MARK: Implement the ImageTests_ImageLoadingRunner() class!\n\t\ttestRunner = ImageTests_ImageLoadingRunner()\n\t}\n\n\tfunc testImageLoading_row1() {\n\t\tlet input = ImageTests_ImageLoadingInput(name: \"available.png\")\n\t\tlet expected = ImageTests_ImageLoadingOutput(loaded: true)\n\t\tlet result = try! testRunner.run(input: input)\n\t\tXCTAssertEqual(expected, result)\n\t}\n\n\tfunc testImageLoading_row2() {\n\t\tlet input = ImageTests_ImageLoadingInput(name: \"missing.png\")\n\t\tlet expected = ImageTests_ImageLoadingOutput(loaded: false)\n\t\tlet result = try! testRunner.run(input: input)\n\t\tXCTAssertEqual(expected, result)\n\t}\n\n}\n\nfunc == (lhs: ImageTests_ImageLoadingOutput, rhs: ImageTests_ImageLoadingOutput) -\u003e Bool {\n\treturn\n\t\tlhs.loaded == rhs.loaded\n}\n```\n\n#### Write your test runner:\n\n```swift\n// User generated file. Put your test runner implementation here.\nclass ImageTests_ImageLoadingTestRunner: ImageTests_ImageLoadingTestRunnable {\n\n    func run(input: ImageTests_ImageLoadingInput) throws -\u003e ImageTests_ImageLoadingResult {\n        // Your business logic here\n        return ImageTests_ImageLoadingResult(loaded: true)\n    }\n}\n```\n\n#### Add your generated test classes and test runners to your Xcode test target and run the tests.\n\n### Notes\n\n* Note the functional style of the test runner. It is simply a method that takes a stronly-typed input value, and returns a strongly-typed output value. **No state, no side effects**.\n\n* `XCTestCase` sublasses can specify a `setUp()` method to configure an initial state that is shared across all unit tests. This is deliberately not supported with  **AcceptanceMark** test runners, and **state-less tests are preferred and encouraged** instead.\n\n## Installation\n\nAcceptanceMark includes **amtool**, a command line tool used to generate unit tests or UI tests.\n\n#### Pre-compiled binary\n\nThe quickest way to install **amtool** is to download the pre-compiled executable from the [project releases](https://github.com/bizz84/AcceptanceMark/releases) page.\n\nOnce dowloaded, don't forget to add execute permission to the binary:\n\n```\nchmod +x amtool\n```\n\n#### Compile manually\n\nXcode 8 is required as **amtool** is written in Swift 3. To compile, clone this repo and run the script:\n\n```\ngit clone https://github.com/bizz84/AcceptanceMark\ncd AcceptanceMark\n./scripts/build-amtool.sh\n```\n\nOnce the build finishes, **amtool** can be found at this location:\n\n```\n./build/Release/amtool\n```\n\nFor convenience, **amtool** can be copied to a folder in your `$PATH`:\n\n```\nexport PATH=$PATH:/your/path/to/amtool\n```\n\n## amtool command line options\n\n```\namtool -i \u003cinput-file.md\u003e [-l swift2|swift3]\n```\n\n* Use `-i` to specify the input file \n* Use `-l` to specify the output language. Currently **Swift 2** and **Swift 3** are supported. **Objective-C** and other languages may be added in the future.\n* Use `--version` to print the version number\n\n## FAQ\n\n* _**Q**: I want to have more than one table for each `.md` file. Is this possible?_\n* **A**: Yes, as long as the file is structured as [ **Heading**, **Table**, **Heading**, **Table**, **...** ], **AcceptanceMark** will generate multiple swift test files named `\u003cfilename\u003e_\u003cheading\u003eTests.swift`. This way, each **test set** gets its own swift classes all in one file. Note that **heading names should be unique per-file**. Whitespaces and punctuation will be stripped from headings.\n\n* _**Q**: I want to preload application data/state for each test in a table (this is done with builders in Fitnesse). Can I do that?_\n* **A**: This is in the future roadmap. While the specification for this may change, one possible way of doing this is by allowing more than one table for each **heading**, with the convention that the **last** table represents the input/output set, while all previous tables represent data to be preloaded.\nUntil this is implemented, all preloading must be done directly in the test runner's `run()` method. Preloading example:\n\n```\n## Image Loading\n\n// Preloaded data\n| Country:String | Code:Bool |\n| -------------- | --------- |\n| United Kingdom | GB        |\n| Italy          | IT        |\n| Germany        | DE        |\n \n// Test runner data\n| name:String   || loaded:Bool  |\n| ------------- || ------------ |\n| available.png || true         |\n| missing.png   || false        |\n```\n\n* _**Q**: I want to preload a JSON file for all tests running on a given table. Can I do that?_\n* **A**: You could do that directly by adding the JSON loading code directly in the test runner's `run()` method. For extra configurability you could specify the JSON file name as an input parameter of your test set, and have your test runner load that file from the bundle.\n\n\n## LICENSE\n\nMIT License. See the [license file](LICENSE.md) for details.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbizz84%2Facceptancemark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbizz84%2Facceptancemark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbizz84%2Facceptancemark/lists"}