With the Cucumber tests, a feature expressed as Given, When and Then is usually implemented as three separate methods. These methods often need to share values, and this it seems that mutable variables are the way to do it.

Although in the ScalaDSL for CucumberJVM, a step is a function f:List[Any] => Any, the current implementation [1] discards the results the each step execution, meaning that you have no way to use the result of a previous step in the next one.

Currently, the only way to share the result of one step is through some shared state, either at the step definition class or a more global context like zihaoyu suggested
(BTW, we use the shared mutable map method as well in a large project)