The best way to prevent cheating in an online test is to set a strict time limit. That way its harder for them to look up the answers on Google etc. The problem then is that a student may experience technical difficulties out of their control. For cases like that, students should be able to appeal for extra time.