We demonstrate an assay to analyze the environmental and genetic cues that influence mating behavior in the fruit fly Drosophila melanogaster.