You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 28, 2019. It is now read-only.
For the time being I'll document it here. When someone is happy with that documentation we can lift it out into the code.
The world argument is the this object - the object in which the step definition method will execute.
The intention is to avoid leaking state between scenarios. Each scenario creates new objects for each scenario, and invokes step definition methods or closures in the context of one of those objects.
Whether to create a single world object or several ones will depend on the programming language.
For JavaScript - a single object would be sufficient, since Function.apply allows executing any function with an arbitrary this object. (Unless the function is anonymous using the () => {} syntax, but that's a different issue).
For Java however, we'll use Method.invoke, which requires the object to be an instance of the class where the method is defined. So we'll need an object for each class hosting stepdef methods.
For Python I believe func.__call__ will be used, and the first argument will be a thisArg object similar to JavaScript that can be shared across stepdef functions in several files.
For the time being I'll document it here. When someone is happy with that documentation we can lift it out into the code.
The
world
argument is thethis
object - the object in which the step definition method will execute.The intention is to avoid leaking state between scenarios. Each scenario creates new objects for each scenario, and invokes step definition methods or closures in the context of one of those objects.
Whether to create a single
world
object or several ones will depend on the programming language.For JavaScript - a single object would be sufficient, since Function.apply allows executing any function with an arbitrary
this
object. (Unless the function is anonymous using the() => {}
syntax, but that's a different issue).For Java however, we'll use Method.invoke, which requires the object to be an instance of the class where the method is defined. So we'll need an object for each class hosting stepdef methods.
For Python I believe
func.__call__
will be used, and the first argument will be a thisArg object similar to JavaScript that can be shared across stepdef functions in several files.Maybe it's better to name the object
thisObject
?Is this clearer now? (ref cucumber/common#8 (comment))
The text was updated successfully, but these errors were encountered: