Use latch to synchronize the test