liveBook · Manning

Question.fromObject API

As explained in BDD in Action, Second Edition

Question.fromObject is a Serenity/JS API operation that combines static, dynamic, or partially dynamic object properties into a QuestionAdapter.

Question.fromObject merges static, dynamic, or partially dynamic object properties into a QuestionAdapter. Use it when a reusable task needs default data with selected overrides. section 15.1.6

Override one field while retaining defaults

A sign-up step can combine the actor's default traveler details with a Cucumber data table. Passing the resulting QuestionAdapter to SignUp.using keeps the task reusable while changing only supplied fields, such as a duplicate email address.

Tasks accepting QuestionAdapter<TravelerDetails> can consume the merged object through the same property-based interface used for ordinary data. Nested fields are wrapped recursively. section 15.1.6

How BDD in Action, Second Edition covers it

How deep it goes
Defines merging and recursive proxy access, but does not detail QuestionAdapter internals or merge conflict behavior.
Examples
Demonstrates traveler registration using default details and a duplicate-email override supplied through a Cucumber data table.
What it assumes
Assumes TypeScript objects, partial properties, Cucumber data tables, and Serenity/JS QuestionAdapter task arguments.
What you can do after
Apply it via Serenity/JS to build parameterized tasks that preserve defaults while exercising workflow variations.
How it connects
Connects QuestionAdapter with Screenplay tasks, Cucumber data tables, notepads, and parameterized workflows.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of BDD in Action, Second Edition. The section links point to the parts of the book it draws on.