Skip to content

How to write and publish reusable steps? #236

Answered by ilslv
ms-ati asked this question in Q&A
Discussion options

You must be logged in to vote

Very interesting use-case, thanks for bringing that up. I've created a separate repository as an example: https://github.com/ilslv/cucumber-steps-as-library

How can a dev-dependency library publish reusable Step Definitions that require state?

You should create a library, that depends on cucumber and exports World implementor with some step definitions. In example repo this is the /steps directory. In case you need additional steps, downstream crates can add them to an existing World implementor from another crate (/tests/cucumber.rs has an example).

The main limitation is that World implementor can't have generics, so I would advice adding something like anymap to it, so users could dy…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by ilslv
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #235 on October 24, 2022 06:48.