Long-term care facilities have been widely affected by the COVID-19 pandemic. Retirement homes are particularly vulnerable due to the higher mortality risk of infected elderly individuals. Once an outbreak occurs, suppressing the spread of the virus in retirement homes is challenging because the residents are in contact with each other and isolation measures cannot be widely enforced. Regular testing strategies, on the other hand, have been shown to effectively prevent outbreaks in retirement homes. However, high frequency testing may consume substantial staff working time, which results in a trade-off between the time invested in testing, and the time spent providing essential care to residents. Thus, developing an optimal testing strategy is crucial to proactively detect infections while guaranteeing efficient use of limited staff time in these facilities. Although numerous efforts have been made to prevent the virus from spreading in longterm care facilities, this is the first study to develop testing strategies based on formal optimization methods. This paper proposes two novel optimization models for testing schedules. The models aim to minimize the risk of infection in retirement homes, considering the trade-off between the probability of infection and staff workload. We employ a probabilistic approach in conjunction with the optimization models, to compute the risk of infection, including contact rates, incidence status, and the probability of infection of the residents. To solve the models, we propose an enhanced local search algorithm by leveraging the symmetry property of the optimal solution. We perform several experiments with realistically sized instances and show that the proposed approach can derive * Corresponding author.