Open bkielbasa opened 4 years ago
I like this and I would certainly use this in our team. Would it be clearer if the comment is in a form of a marker and starts with the +
sign to differentiate it from normal comments? For example:
// +gobdd-step: I add (\d+) and (\d+)
Would there be also a viable option not to have the ConfigureSteps
at all? I've looked deeply at how the https://magefile.org/ works - it's using both build tags and markers and auto-generates a temporary go file (could this in our case contain the ConfigureSteps
?), which it then runs, and after the run it removes the temporary file. There's a flag not to delete the generated file, for debugging purposes etc.
Thanks for your comment. I updated the description with the marker.
About skipping the ConfigureSteps
function. As I mentioned earlier, I'm not a huge fan of a lot of magic. And what's more, to do it we'll probably have to have an external binary which will generate and remove the file. That's what godog does and this is one of main reasons why this lib was created.
But, if you find an idea of improving it - please create the proposal :)
Describe the solution you'd like We discussed in #65 that we want some kind of way of writing less test code. My idea is to add markers to functions which define the step definition. The first words should be
GoBDD step:
and after that, there should be a regular expression. Example:After calling command
gobdd configure generate
the command will output a new function definition.It will be copy&paste ready peace of code. If you provide the
-f output.go
parameter, the command will parse theoutput.go
code:ConfigureSteps
func, it will add it as the very last function in the file