A new virus emerges  and spreads like wildfire. In order to contain it, researchers must first collect data  about who’s been infected. Two main viral testing techniques  are critical: one tells you if you have the virus and the other shows  if you’ve already had it. So, how exactly do these tests work? PCR, or polymerase chain  reaction testing, targets the virus’s genetic material  in the body and is used to diagnose someone  who is currently infected. Yet, this genetic material may be present  in such imperceptible amounts that actually detecting it is difficult. This is where PCR comes in: it’s widely used to amplify genetic  information to large enough quantities that it can be readily observed. To develop a PCR test  for a never-before-seen virus, researchers first sequence  its genetic material, or genome, and identify regions that are unique  to that specific virus. PCR then targets  these particular segments. A PCR test begins by collecting a sample: this can be blood for hepatitis viruses,  feces for poliovirus, and samples from the nose or throat  for coronaviruses. The sample is taken  to a central laboratory where PCR is performed to test  for the presence of the virus’ genome. Genetic information can be encoded  via DNA or RNA. HPV, for example, uses DNA,  while SARS-CoV-2, the cause of COVID-19, uses RNA. Before running the PCR,  the viral RNA— if present— must be reverse transcribed  to make a strand of complementary DNA. Researchers then run the PCR. If the virus is present in the sample,  its unique regions of genetic code will be identified by complementary  primers and copied by enzymes. One strand of DNA becomes  hundreds of millions, which are detected using probes marked with fluorescent dye. If the PCR machine senses fluorescence, the sample has tested positive  for the virus, meaning the individual is infected. Immunoassays, on the other hand, tap into the immune system’s  memory of the virus, showing if someone has previously  been infected. They work by targeting virus-specific antibodies generated by the immune system during infection. These are specialized classes of proteins that identify and fight foreign  substances, like viruses. Immunoassays may detect IgG antibodies,  the most abundant class, and IgM antibodies, the type that’s first  produced in response to a new infection. The presence of IgM antibodies suggests  a recent infection, but since it can take the body over  a week to produce a detectable amount, they’re unreliable in diagnosing  current infections. Meanwhile, IgG antibodies circulate  for an extended period after infection; their presence usually indicates  that someone was exposed and recovered. Before the immunoassay, health professionals draw blood  from an individual. This sample then comes into contact  with a portion of the virus of interest. If the body has, in fact, been exposed  to the virus in the past, the body’s virus-specific antibodies  will bind to it during the test. This reaction produces a change in color,  indicating that the sample tested positive and that the individual has been  exposed to the virus. Immunoassays are especially important when it comes to retroactively  diagnosing people who were infected but went untested. And there’s exciting potential for those who have developed immunity to a virus: in some cases, their blood plasma  could be used as treatment in people who are currently fighting it. PCR and immunoassays are always  in the process of becoming more accurate and efficient. For example, innovations in PCR have led to the use of self-contained testing devices that relay results within one hour. Digital PCR, which quantifies individual  pieces of target DNA, shows promise in further boosting accuracy. And although immunoassays are difficult  to develop quickly, researchers in Singapore were able  to create one for SARS-CoV-2 even before COVID-19 was declared  a pandemic. These tests— along with the scientists  who develop them and the health professionals  who administer them— are absolutely essential. And when deployed early,  they can save millions of lives.