To quantitatively understand chemosensory behaviors, it is desirable to present many animals with repeatable, well-defined chemical stimuli. To that end, we describe a microfluidic system to analyze Caenorhabditis elegans behavior in defined temporal and spatial stimulus patterns. A 2 cm × 2 cm structured arena allowed C. elegans to perform crawling locomotion in a controlled liquid environment. We characterized behavioral responses to attractive odors with three stimulus patterns: temporal pulses, spatial stripes and a linear concentration gradient, all delivered in the fluid phase to eliminate variability associated with air-fluid transitions. Different stimulus configurations preferentially revealed turning dynamics in a biased random walk, directed orientation into an odor stripe and speed regulation by odor. We identified both expected and unexpected responses in wild-type worms and sensory mutants by quantifying dozens of behavioral parameters. The devices are inexpensive, easy to fabricate, reusable and suitable for delivering any liquid-borne stimulus.