Is is ethical to not compensate experiment participants who withdraw from the study?
I don't see any ethical problem in not compensating people for work they don't do. However, you still have to frame the problem in a clear way in order to avoid frustration/litigations. Just write down explicitely that a student will receive compensation only if he/she completes the test. 

As for motivating students to give you meaningful answer, that is a completely different story, and a much more complex one.