lambdaisland / lambdaisland/kaocha-cucumber
Feature request: Add default parameter type for keywords
Nobody has claimed this yet.
- Dominant language
- Clojure
- Stars
- 44
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Description
It's certainly common enough for my feature files to use :keywords as well as "strings" for Clojure/script code bases, which is very easy to implement locally in tests.edn by doing:
#kaocha/v1
{:tests [{:id :features
:type :kaocha.type/cucumber
,,,
:cucumber/parameter-types
[#:cucumber.parameter
{:name "keyword"
:regexp ":[\\w\\*\\+\\!\\?\\-_]+(?:/[\\w\\*\\+\\!\\?\\-_]+)?"
:class clojure.lang.Keyword
:transformer clojure.edn/read-string}]}]}
And then in a feature file:
Feature: Using keywords
Given x is :my/keyword
Then calling (namespace x) returns "my"
And calling (name x) returns "keyword"
And consuming it (without manual parsing) in a step definition e.g.
(Given "x is {keyword}" [state kw]
(assoc state :x kw))
N.B. The regular expression is constructed based on https://stackoverflow.com/questions/3951761/what-are-the-allowed-characters-in-a-clojure-keyword
This, to me, seems like a very sensible thing to have baked in, but I believe at least this snippet should be in the docs somewhere.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Cucumber configuration shown in tests.edn and inspect the existing parameter-type setup. Verify the supplied keyword feature and step-definition examples, then determine whether the keyword type belongs in the defaults or documentation; done means keyword arguments work without manual parsing or the configuration is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100