How does a Coronavirus "test kit" work?
The CDC has made available online its nCoV test kit. Briefly,the kit contains primers and probes for real-time reverse-transcriptase PCR, as well as instructions for appropriate use and (critically) controls and guidelines to avoid false positives and negatives. Kits from different countries may use slightly different primers and probes, though since they are all working from the same sequences and the same principles they should be broadly quite similar. 

Explaining how quantitative PCR works and the details of the primers and probes is out of the scope of this SE. A layman's introduction was written by John Timmer at Ars Technica.