The present disclosure provides methods and systems for performing, observing, and/or recording defecation motor program (DMP) events using microfluidic devices. The methods may be performed wherein the nematodes ingest fluorescent or color material and are then loaded in a microfluidic chip and stimulated to feed and defecate. DMP events are observed with use of a fluorescent microscope. In other methods, a microfluidic device with two or more electrodes is used to record electrical events of the DMP.