Code-Based Testing with Constraints