Step parameters should be converted just before the step executes (not when the scenario is parsed)

Description

I should be able to use a ParamaterConverter to retrieve an entity from the database, e.g.

Given an employee called Bob
When I give Bob a pay rise of 10,000 pounds
Then Bob forgets about his embarrassing law suit

EmployeeSteps.java

EmployeeConverter.java

The parameter converter would be simple to implement, but currently won't work without shenanigans because the step arguments are converted when the step is created, and all the steps in a scenario are created up front, before any of them are executed. This means that at the time the parameter converter attempts to retrieve the entity from the database it hasn't been created.

To get around the problem I've created a LazyCandidateStep class, which only creates the Step in the perform or doNotPerform methods. This isn't ideals however because I also have to override Steps.createCandidateStep. I've attached my workaround as an example.

Assignee

Unassigned

Reporter

Stephen Cresswell

Labels

None

Components

Fix versions

Affects versions

Priority

Major
Configure