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 model14 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/PBT18 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 testing14 and property-based testing18.

Sources

  1. 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.
  2. 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.
  3. Graph & Paths. David Khourshid · Stately docs. Path generation docs; used for createTestModel and getShortestPaths. Accessed 2026-10-01.
  4. 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.

Last changed 2026-10-07 in 0e2d656. Source on GitHub. Change log.

Linked from

  1. Agent guide. An Effect stack so pure (aspirational) Kit Langton will blush.

    David Khourshid — David Khourshid teaches state machines with XState and argues for model-based and property-based testing.

  2. Change log. What changed in the files served here, newest first.

    David Khourshid — edited: feat(learn): teach cards 23 to 42 with plain lines, diagrams and snippets

  3. Effect 4 study: September 2026. Dated Effect 4 source studies from September 2026; current versions live in pins.md.

    Author David Khourshid.

  4. Full agent guide. An Effect stack so pure (aspirational) Kit Langton will blush.
  5. 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.

  6. 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.

  7. Source change history (log.md). The generated change log as Markdown.

    David Khourshid — edited: feat(learn): teach cards 23 to 42 with plain lines, diagrams and snippets