David Khourshid
David Khourshid wrote Model-Based Testing in React with State Machines for CSS-Tricks in 2019. It explains how to generate tests from a state machine instead of writing each case by hand.¶
In the testing lesson of his Frontend Masters course on XState, he describes a test model17 as “a state machine, and the state machine represents all of your given when then statements in a single state machine.” He adds that model-based testing lets you “test any application whether they’re using state machines or not.” Testing, State Machines in JavaScript with XState, v2¶
XState is a library for defining and running state machines.
It carries that idea in xstate/graph with createTestModel and getShortestPaths. Graph & Paths¶
On 2026-10-01 he told Joel, “I need to get you on the MBT/PBT22 train.” X MBT means model-based testing: compare the application with a model across action sequences. PBT means property-based testing: check rules with generated inputs. This repo uses both: see model-based testing17 and property-based testing22.¶
On 2026-11-09 he described implicit state machines7. X They are ad-hoc transition logic spread across a codebase. See implicit state machines7 for his words and our worked example.¶
Sources
- Model-Based Testing in React with State Machines. David Khourshid · CSS-Tricks. State-machine testing article; used for David's model-based testing approach. Accessed 2026-10-01.
- Testing - State Machines in JavaScript with XState, v2 | Master.dev. David Khourshid · Master.dev. Testing lesson; used for the XState testing course reference. Accessed 2026-10-01.
- Graph & Paths. David Khourshid · Stately docs. Path generation docs; used for createTestModel and getShortestPaths. Accessed 2026-10-01.
- David K 🎹 on X: "@joelhooks I need to get you on the MBT/PBT train" / X. David Khourshid. Public reply; used for David's invitation to adopt model and property testing. Accessed 2026-10-01.
- David K 🎹 on X: "What is an implicit state machine?" / X. David Khourshid. Post of 2026-11-09; used for his description of implicit state machines. Accessed 2026-11-09.
Last changed 2026-11-09 in 91adf29. Source on GitHub. Change log.
Linked from
- Agent guide. An Effect stack so pure (aspirational) Kit Langton will blush.
David Khourshid: David Khourshid added the experimental @xstate/effect integration to XState.
- Change log. What changed in the files served here, newest first.
David Khourshid — edited: lore: implicit state machines, with David Khourshid’s definition and the deploy poll before and after
- Effect 4 study: September 2026. Dated Effect 4 source studies from September 2026; current versions live in pins.md.
Author David Khourshid.
- Full agent guide. An Effect stack so pure (aspirational) Kit Langton will blush.
- Implicit state machines. Every app runs state machines; the risky ones are scattered across flags, conditions and loops where nobody can list the transitions.
David Khourshid, who teaches state machines with XState, posted this on 2026-11-09.
- Model-based testing. Describe what a system should do as a small model, generate action sequences, and check the real system against the model.
David Khourshid described the approach with state machines in Model-Based Testing in React with State Machines.
- Rat Stack lore | rat-stack. Short, source-grounded notes on the ideas and decisions behind rat-stack.
David Khourshid — David Khourshid teaches state machines with XState and argues for model-based and property-based testing.
- Source change history (log.md). The generated change log as Markdown.
David Khourshid — edited: lore: implicit state machines, with David Khourshid’s definition and the deploy poll before and after