Open jangalinski opened 2 months ago
A bit context: I have a use case (process testing) where I make some assumption about the system behaviour in given() - here I prepare mocks and set conext data, and verify these assumptions and the taken paths through the process in then().
The when() part is dynamic, so in the Stage-Method "the_process_completes" I execute a list of operations until the condition (process ende) is met. I use StepFunctions to pre-register the steps necessary to reach the process end. But I do not see them (correctly) in the report .. I only can somehow fake the step-name by using the description.
Hi @jangalinski, sorry for the late reply.
I took a short look at your problem. If I gauged the feature correctly, then we use the fact that JGiven automatically replaces all $
with values from the argument. So I guess that it could be possible to read the name of the function object.
I am however unsure whether this is advisable to be provided by JGiven, because the current step formatter method allows also to take lambdas and method references which don't resolve into nice names; even for function objects, we would somehow need to understand that we should read the method name from the object here. We might run into a ton of unusabel edge cases with this one...
Maybe you could make a change request and we can have a look at it together?
Alternatively one of the following thinks might work:
) you set up your own $(StepFunction<>) method. The current one prevents consumption of the step function with the @Hidden annotation. Maybe you'll get something useable if you override the method
) or instead of registering function objects, you register a
class StepFunctionContainer {
String description();
Sting getFunction();
}```
which you can then invoke via `self().$(container.getDescription, container.getFunction)`.
Hope this helps.
When I use NestedSteps as documented:
I get a nicley generated report for "I_enter_a_name" as expected.
When I however use Stepfunctions
I only get the "custom description" literal, no parameters, no formatting ...
Feature request: I can call a StepFunction without providing a description and when I do so, the regular stepName is used in the report.
Question: is this possible? Looks like there shouldn't be much difference between calling the step directly on the stage instance or doing so inside a step function.