The pupils were writing a test while the teacher was checking the homework.
Ответ: were writing; was checking