Some improvements to test API.