Check test is defined before checking state