Define the test_defined? method dynamically