Effective personnel scheduling is crucial for organizations to match workload demands. However, staff scheduling is sometimes affected by unexpected events, such as the COVID-19 pandemic, that disrupt regular operations. Limiting the number of on-site staff in the workplace together with regular testing is an effective strategy to minimize the spread of infectious diseases like COVID-19 because they spread mostly through close contact with people. Therefore, choosing the best scheduling and testing plan that satisfies the goals of the organization and prevents the virus’s spread is essential during disease outbreaks. In this paper, we formulate these challenges in the framework of two Mixed Integer Non-linear Programming (MINLP) models. The first model aims to derive optimal staff occupancy and testing strategies to minimize the risk of infection among employees, while the second is aimed only at optimal staff occupancy under a random testing strategy. To solve the problems expressed in the models, we propose a canonical genetic algorithm as well as two commercial solvers. Using both real and synthetic contact networks of employees, our results show that following the recommended occupancy and testing strategy reduces the risk of infection 25–60% under different scenarios. The minimum risk of infection can be achieved when the employees follow a planned testing strategy. Further, vaccination status and interaction rate of employees are important factors in developing scheduling strategies that minimize the risk of infection.