{"id":17597783,"url":"https://github.com/themkat/spek-spring-utils","last_synced_at":"2025-08-30T14:31:08.946Z","repository":{"id":87206635,"uuid":"149158772","full_name":"themkat/spek-spring-utils","owner":"themkat","description":"Utilities for using Spring with Spek. Aims to make the hurdles of testing Spring applications in Spek non-existant. NOTE: This was an experiment I did long ago, and is now archived. Feel free to use it for whatever you like :)","archived":true,"fork":false,"pushed_at":"2019-01-22T20:57:10.000Z","size":25,"stargazers_count":5,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-30T05:46:23.327Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/themkat.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}},"created_at":"2018-09-17T16:58:13.000Z","updated_at":"2025-03-29T09:28:52.000Z","dependencies_parsed_at":"2023-03-13T19:43:36.781Z","dependency_job_id":null,"html_url":"https://github.com/themkat/spek-spring-utils","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/themkat/spek-spring-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themkat%2Fspek-spring-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themkat%2Fspek-spring-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themkat%2Fspek-spring-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themkat%2Fspek-spring-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/themkat","download_url":"https://codeload.github.com/themkat/spek-spring-utils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themkat%2Fspek-spring-utils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272860925,"owners_count":25005515,"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-08-30T02:00:09.474Z","response_time":77,"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":[],"created_at":"2024-10-22T09:43:42.476Z","updated_at":"2025-08-30T14:31:08.612Z","avatar_url":"https://github.com/themkat.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spek Spring Utils\nThe goal of this project is to make testing Spring applications painless when using Spek as a testing framework. Obviously the name and initial goal of MockMVC testing comes from [spock-spring-utils](https://github.com/jarlehansen/spock-spring-utils). This started as me just hacking away in the evenings and learning more about Spring (out of need, because the hassle of using it with Spek bothered me), so it may have some issues. I still hope that it may evolve into something usable in the near future. So far only tested with Spring Boot, but should work on old Spring as well. I probably have to test it and maybe fix some dependency handling, as well as cleaning the code. \n\n## NOTE: This is an early version and may have issues. Feel free to report any issues you may have if you try it! Note that there may be some obvious improvements that can be done in the code, so take that into consideration before reporting. This project used Spek2, so there may be (and probably are) incompatibilities to the old version of Spek.\n\n\n## TODOs and missing functionality\nThis project is a work-in-progress, and things may change. Below is a list of bullet points I plan to investigate and implement. If you have any good solutions to these, please feel free to fork the repo and create a pull request :smile: \n\n* Clean the Gradle scripts. I have never used Gradle beyond simple experiments, so I may have some weirdness in there. Let me know, and I will learn something new :) \n* More tests to document usage. \n* Supporting only having one Spring application context for several specifications/tests (if needed)\n* Making the use of the springContext DSL more user-friendly. Examples include not having to write the package name every time, but instead just use the package it is used from.\n* Checking up on memory issues. Some memory issues may happen when handling Spring application context manually. Some care should be made to see that it's not the case here (or if it is, fix it!). Close should have fixed most of these, especially in newer versions of Spring.\n* Adding option to use XML configuration without making the DSL suffer\n\n\n## Maven / Gradle depenency\nWant to try this testing library in your project? Feel free to :) Either by building the latest version on Github yourself, or by using the dependencies from the Bintray repo.\n\n### Maven dependency\nYou first need to add the Bintray repository for this project:\n```xml\n    \u003crepositories\u003e\n        \u003crepository\u003e\n            \u003cid\u003espek-spring-utils\u003c/id\u003e\n            \u003curl\u003ehttps://dl.bintray.com/themkat/spek-spring-utils\u003c/url\u003e\n        \u003c/repository\u003e\n    \u003c/repositories\u003e\n```\n\nThen simply add the dependency like normal:\n```xml\n        \u003cdependency\u003e\n            \u003cgroupId\u003enet.themkat.spek.spring.utils\u003c/groupId\u003e\n            \u003cartifactId\u003espek-spring-utils\u003c/artifactId\u003e\n            \u003cversion\u003e0.1.0\u003c/version\u003e\n        \u003c/dependency\u003e\n```\n\n\n### Gradle dependency\nLike Maven, you first need to add the Bintray repository for this project:\n```\nrepositories {\n    maven {\n        url  \"https://dl.bintray.com/themkat/spek-spring-utils\" \n    }\n}\n```\n\nThen simply add the dependency like normal:\n```\ntestCompile(\"net.themkat.spek.spring.utils:spek-spring-utils:0.1.0\")\n```\n\n\n## Dependencies needed\nThis project includes no Spring related dependencies, because Spring is notorious for version-incompatibilities. The following dependencies are needed:\n* org.springframework:spring-test\n* org.springframework:spring-context\n* org.springframework:spring-tx\n\nWill probably be updated as Spring Boot dependencies was used for this project. If you use Spring Boot, then you can use the following dependencies:\n* org.springframework.boot:spring-boot-starter-test\n* org.springframework.boot:spring-boot-starter-data-jpa\n\nYou will also need the Kotlin standard library and the Kotlin-reflect package. \n\n\n### Running the Spek tests with Maven\nThe easiest way to run the tests is without a doubt the Spek plugin for IntelliJ IDEA, but you may want it as part of your build pipeline in CI systems (or maybe you just enjoy the terminal like me ;) ). To be able to run your Spek tests using `mvn clean install`, `mvn test` or something similar, you will have to add a Test Engine. Spek 2 uses JUnit 5, so the natural choice for me is to add a dependency to that engine (the version is simply there as an example):\n\n```xml\n\t\t\u003cdependency\u003e\n\t\t\t\u003cgroupId\u003eorg.junit.jupiter\u003c/groupId\u003e\n\t\t\t\u003cartifactId\u003ejunit-jupiter-engine\u003c/artifactId\u003e\n\t\t\t\u003cversion\u003e5.3.1\u003c/version\u003e\n\t\t\t\u003cscope\u003etest\u003c/scope\u003e\n\t\t\u003c/dependency\u003e\n```\n\nYou may also want to configure the Maven Surefire plugin to pick up your tests if you use a different naming strategy than Test at the end of the name. I prefer to use Spec at the end of the names in my tests (because I read them as specifications almost more than tests). To make Surefire plugin pick up your tests, you can add the following to your build plugins (Surefire version added just as an example):\n\n```xml\n            \u003cplugin\u003e\n                \u003cartifactId\u003emaven-surefire-plugin\u003c/artifactId\u003e\n                \u003cversion\u003e2.22.0\u003c/version\u003e\n                \u003cconfiguration\u003e\n                    \u003cincludes\u003e\n                        \u003cinclude\u003e**/*Spec.*\u003c/include\u003e\n                    \u003c/includes\u003e\n                \u003c/configuration\u003e\n            \u003c/plugin\u003e\n```\n\n\n## Usage examples\nSeparate examples will be added here. To get started quickly, take a look in the test-folder for examples. Different examples will be added below.\n\n\n### Testing DAOs/JPA-repositories\n...\n\n### MockMVC\n...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthemkat%2Fspek-spring-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthemkat%2Fspek-spring-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthemkat%2Fspek-spring-utils/lists"}