Cheating reduces the signal value of exam data and it might shift the focus of teachers and students away from learning. However, it is difficult to prevent cheating if it is widespread. We evaluate the impact of computer-based testing (CBT) on national exam scores in junior secondary schools in Indonesia, exploiting the phased roll-out of the program from 2015 to 2019. First, we find that test scores decline dramatically after the introduction of CBT with school level means declining by 0.4 standard deviation. Schools with response patterns that indicate cheating experience an increased drop in their test scores. Second, scores rebound within two years after introducing CBT, suggesting that barriers to cheating provide incentives for learning. Third, we find evidence of spillover effects from CBT within districts. Cheating declines more in schools that have not yet switched to CBT if more schools located in the same districts make the switch, suggesting that CBT not only eliminates cheating but makes it less socially permissible.