{"id":13995347,"url":"https://github.com/shibapm/capriccio","last_synced_at":"2025-08-01T15:40:56.550Z","repository":{"id":63920502,"uuid":"147513320","full_name":"shibapm/capriccio","owner":"shibapm","description":"Reads gherkin feature files and generates UI Tests ","archived":false,"fork":false,"pushed_at":"2023-12-14T16:14:42.000Z","size":98,"stargazers_count":20,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T19:47:55.924Z","etag":null,"topics":["automatic","capriccio","compile-time","feature-file","generator","gherkin","gherkin-files","swift4","xctest-gherkin"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shibapm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2018-09-05T12:21:05.000Z","updated_at":"2024-02-26T15:31:19.000Z","dependencies_parsed_at":"2024-01-20T18:05:03.754Z","dependency_job_id":null,"html_url":"https://github.com/shibapm/capriccio","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shibapm%2Fcapriccio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shibapm%2Fcapriccio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shibapm%2Fcapriccio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shibapm%2Fcapriccio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shibapm","download_url":"https://codeload.github.com/shibapm/capriccio/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248131328,"owners_count":21052819,"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":["automatic","capriccio","compile-time","feature-file","generator","gherkin","gherkin-files","swift4","xctest-gherkin"],"created_at":"2024-08-09T14:03:21.539Z","updated_at":"2025-04-10T00:00:33.592Z","avatar_url":"https://github.com/shibapm.png","language":"Swift","funding_links":[],"categories":["Swift"],"sub_categories":[],"readme":"# Capriccio\n![Swift 5.0](https://img.shields.io/badge/Swift-5.0-blue.svg)\n[![Build Status](https://app.bitrise.io/app/ac2572c809b906b7/status.svg?token=or92GFZDMVH_iZxnvEHyfw\u0026branch=master)](https://app.bitrise.io/app/ac2572c809b906b7)\n[![codecov](https://codecov.io/gh/f-meloni/capriccio/branch/master/graph/badge.svg)](https://codecov.io/gh/f-meloni/capriccio)\n\nCapriccio is a tool to generate UI Tests from gherkins `.feature` files.\n\nCapriccio generates test files using [XCTest-Gherkin](https://github.com/net-a-porter-mobile/XCTest-Gherkin) by default, but can use your own Stencil template :)\n\n# An example of how it works\nIf you have a feature files like\n```\nFeature: Feature number one\n\nScenario: Scenario I want to  test\nGiven I'm in a situation\nWhen something happens\nThen something else happens\n\nScenario: Other scenario I want to  test\nGiven I'm in another situation\nWhen something different happens\nThen something else happens\n```\n\nIt generates:\n\n```swift\nimport XCTest\nimport XCTest_Gherkin\n\nfinal class FeatureNumberOne: XCTestCase {\n    func testScenarioIWantToTest() {\n        Given(\"I'm in a situation\")\n        When(\"Something happens\")\n        Then(\"Something else happens\")\n    }\n\n    func testOtherScenarioIWantToTest() {\n        Given(\"I'm in another situation\")\n        When(\"Something different happens\")\n        Then(\"Something else happens\")\n    }\n}\n```\n\n# What is the benefit of using Capriccio?\nGherkin feature files can be easly shared between different platform.\nWith Capriccio you to generate executable code from the feature files on a specific folder, all you have to do is run Capriccio as part of your build process (For example in a script phase).\n\n### Runtime vs Compile time\nThere a lot of different tools that allows to run tests from a feature files, like [Cumberish](https://github.com/Ahmed-Ali/Cucumberish) or [XCTest-Gherkin](https://github.com/net-a-porter-mobile/XCTest-Gherkin).\nBut they generates the tests at runtime.\nBy generating the tests at compile time you get some benefits:\n- You can use the navigator to see, inspect and re run the tests\n- You have a better integration with some CI services\n- You can actually see the generated test code\n\n# How to use it\n\nto use it just run:\n```bash\ncapriccio source destination \u003coption\u003e\n```\n**source**                  The path to the folder that contains the feature files\n**destination**             The path to the folder where the swift files will be generated\n\n## Command line options\n- `--excluded-tags` - The list of excluded tags separated by a comma\n- `--included-tags` - The list of included tags separated by a comma\n- `--class-type` [default: XCTestCase] - The class type of the generated class\n- `--single-file` - Generates a single swift file with the content of all the feature files\n- `--disable-swiflint` - Disables swiftlint on the file\n- `--template-file` - Path to the stencil template file\n\n## Configuration file\nInstead of CLI arguments you can use `.capriccio.yml` configuration file:\n\n```yml\nsource: \u003csource path\u003e\noutput: \u003cdestination path\u003e\ntemplate: \u003ctemplate path\u003e\nexcludedTags:\n    - \u003cstring value\u003e\n    - \u003cstring value\u003e\nincludedTags:\n    - \u003cstring value\u003e\n    - \u003cstring value\u003e\nclassType: \u003cstring value\u003e\nsingleFile: \u003cbool value\u003e\ndisableSwiftLint: \u003cbool value\u003e\n```\n\n# Personalise setUp and tearDown\nYour UI Tests will probably need to do something that is specific to your code base before and after every test.\nIn order to allow Capriccio to support all this needs you can use the `-c` or `--class-type` option.\nThis allows you to create a generic class that you can use as superclass for all the generated classes.\n\ne.g.\n\n```swift\nclass GherkinTestCase: XCTestCase {\n    var mockedServer: MockedServer\n    var stepDefinition: StepDefinitions!\n    var application: App!\n\n    override func setUp() {\n        super.setUp()\n        mockedServer = MockedServer()\n        mockedServer.start()\n        \n        stepDefinition = StepDefinitions(testCase: self)\n\n        application = App()\n        application.launch()\n    }\n\n    override func tearDown() {\n        mockedServer.stop()\n        application.terminate()\n        super.tearDown()\n    }\n}\n```\n\nThen if you run:\n\n```bash\ncapriccio source destination -c GherkinTestCase\n```\n\nAll the generated classes will be a subclass of `GherkinTestCase` instead of a subclass of `XCTestCase`\n\n# Scenario outline\nCapriccio creates a different test for each example.\n\ne.g.\n\n```\nFeature: Feature number one\n\nScenario Outline: Scenario I want to  test\nGiven I'm in a situation\nWhen something happens \u003ckey1\u003e\nThen something else happens \u003ckey2\u003e\nExamples:\n| key1 | key2 |\n| value1 | value2 |\n| value3 | value4 |\n```\nGenerates:\n```swift\nimport XCTest\nimport XCTest_Gherkin\n\nfinal class FeatureNumberOne: XCTestCase {\n    func testScenarioIWantToTestWithValue1AndValue2() {\n        Given(\"I'm in a situation\")\n        When(\"Something happens value1\")\n        Then(\"Something else happens value2\")\n    }\n        \n    func testScenarioIWantToTestWithValue3AndValue4() {\n        Given(\"I'm in a situation\")\n        When(\"Something happens value3\")\n        Then(\"Something else happens value4\")\n    }\n}\n```\n\n# Create your own template\nCheck our [Model class](https://github.com/shibapm/capriccio/blob/master/Sources/CapriccioLib/Gherkin%2BSwiftCode.swift) to see which properties you can use on your Stencil template.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshibapm%2Fcapriccio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshibapm%2Fcapriccio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshibapm%2Fcapriccio/lists"}