Helper for testing with caching