The deflection of the compass needle shows that the current is flowing through the circuit. The circuit is complete since free end of the tester are dipped in a solution. The solution is certainly a conducting solution. This is the reason why the compass needle shows a deflection.