During an outbreak, nucleic acid testing is essential for early infection detection and virus transmission control. In this study, we aim to location and capacity planning of testing facilities, balancing minimal costs with maximum population coverage during public health emergencies. We propose a novel two-stage robust optimization model that addresses uncertainties in sampling demand during an epidemic, with distinct phases for sampling and testing. Applying this model to medium and high-risk areas in Beijing during COVID-19, we use the column-and-constraint generation (C&CG) algorithm and c...