planning tests and caching queries