{"id":18384861,"url":"https://github.com/allegro/spunit","last_synced_at":"2025-10-26T07:39:47.840Z","repository":{"id":65510181,"uuid":"562882340","full_name":"allegro/spunit","owner":"allegro","description":"Spunit – Spock elegance in Kotlin JUnit 5 tests","archived":false,"fork":false,"pushed_at":"2025-09-15T16:45:54.000Z","size":371,"stargazers_count":16,"open_issues_count":2,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-17T09:42:53.686Z","etag":null,"topics":["junit","junit5","spock-framework","test"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/allegro.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-11-07T13:07:37.000Z","updated_at":"2025-08-26T05:10:20.000Z","dependencies_parsed_at":"2024-02-19T17:39:18.837Z","dependency_job_id":"6c4716d0-78a9-4148-a46b-5c28c8755ceb","html_url":"https://github.com/allegro/spunit","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/allegro/spunit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allegro%2Fspunit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allegro%2Fspunit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allegro%2Fspunit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allegro%2Fspunit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allegro","download_url":"https://codeload.github.com/allegro/spunit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allegro%2Fspunit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281074246,"owners_count":26439421,"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-10-26T02:00:06.575Z","response_time":61,"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":["junit","junit5","spock-framework","test"],"created_at":"2024-11-06T01:15:43.249Z","updated_at":"2025-10-26T07:39:47.822Z","avatar_url":"https://github.com/allegro.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"Spunit\n==============================\n# What is this?\n\nThis library has one purpose: to mimic Spock elegance in Kotlin JUnit 5 tests.\n\n# Ok sounds good, so show me the code.\n\nLook at this screenshot and decide if you want stick to parameterized tests in JUnit 5, or write tests with Spock elegance in Kotlin.\n\n![Test](./screenshots/tests-screenshot.png)\n\n# Disclaimer\nThis library is in early development stage, API can be changed from version to version, documentation is not finished, bugs and not well described exception can happen.\n\n# Documentation\n\n## Features inspired by Spock\n- [x] Parametrization with `where` table. Types of parameters are strictly checked.\n```kotlin\n@Spunit\nfun test() = test { foo: Int?, bar: BigDecimal, expected: String? -\u003e\n        // test code\n    }.where {\n        \"foo\" I \"bar\"             II \"expected\"\n        1     I BigDecimal(2)     II \"3\"\n        null  I BigDecimal(1)     II null\n        5     I BigDecimal(1)     II \"6\"\n    }\n```\n- [x] `given`, `when`, `then`, `expect` blocks.\n```kotlin\n        given(\"bar\")\n        val bar = 1\n\n        `when`(\"baz = foo + bar\")\n        val baz = foo?.let { it + bar }\n\n        then(\"baz == expected\")\n        assertThat(baz?.toString()).isEqualTo(expected)\n```\n- [x] Parametrization of test title.\n```kotlin\n@Spunit\nfun `should run test with two parameters`() = test(\"#foo + 1 = #expected\") { foo: Int?, expected: String? -\u003e\n        // code\n    }.where {\n        \"foo\" II \"expected\"\n        1     II \"2\"\n        null  II null\n        5     II \"6\"\n    }\n```\n![Parametrization](./screenshots/parametrization-of-test-title.png)\n\n## How to start\nAdd one dependency, and you are good to go.\n```groovy\ntestImplementation group: 'pl.allegro.tech', name: 'spunit', version: version\n```\nA good introduction to this library is this [test file](./src/test/kotlin/pl/allegro/tech/spunit/SpunitTest.kt).\n\n## Gotchas\n- This lib is build on Junit 5 dynamic tests. Lifecycle of dynamic test is different from normal. `@BeforeEach`, `@AfterEach` are only run once on start and end respectively. This problem is solved by Spunit lifecycle hooks (`SpunitHooks` interface).\n- Sometimes title of parameterized test doesn't render parameters at all. There is an issue in gradle repo which tracks this problem https://github.com/gradle/gradle/issues/5975. \n- There is no formatter for where block, so autoformatting can make mess.\n\n# Changelog\n## 0.1.1\n- Fix OneParamTestCase displayName\n## 0.1.0\n- Release as open-source software\n\n# License\nSpunit is released under the Apache 2.0 license (see [LICENSE](LICENSE))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallegro%2Fspunit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallegro%2Fspunit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallegro%2Fspunit/lists"}