She sat the civil service exam for three years and finally made it.
Tips
usage
考公 is short for 考公务员 'to sit the civil service exam'. It has siblings: 考研 'graduate school entrance exam', 考编 'exam for a permanent state-sector post', 考博 'doctoral entrance exam'. Passing is 上岸 'reaching the shore'.
culture
A government post is prized as a 铁饭碗 'iron rice bowl', a job for life, and millions of people sign up for the national exam 国考 every year.