Skip to content
This repository was archived by the owner on May 28, 2019. It is now read-only.
This repository was archived by the owner on May 28, 2019. It is now read-only.

Document TestStep.execute(world, ...) #9

@aslakhellesoy

Description

@aslakhellesoy

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.

Maybe it's better to name the object thisObject?

Is this clearer now? (ref cucumber/common#8 (comment))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions