September 2023
Intermediate to advanced
470 pages
11h 12m
English
Let’s consider the second story: adding an item to a list. Writing a DDT isn’t difficult, but starting from scratch can be a bit daunting. The trick is to think in terms of a use-case scenario: how would we describe it using small actors’ steps? To make the DDT compile we can add the steps as empty functions in the actor until we’re satisfied with the scenario code.
| ① | class ModifyAToDoListDDT: ZettaiDDT(allActions()){ |
| | |
| | val ann by NamedActor(::ToDoListOwner) |
| | |
| | @DDT |
| ② | fun `The list owner can add new items`() = ddtScenario { |
| | |
| | setup { |
| ③ | ann.`starts with a list`("diy", emptyList()) |
| | }.thenPlay( |
| ④ | ann.`can add #item to #listname`("paint the shelf", "diy"), |
| |
Read now
Unlock full access