Added better test error state caputre