How to load module include files in .test file? I'm trying to update the Drupal 7 version of the password_policy.test file that is included with the Password Policy module. When I run the tests, I'm getting "Fatal error: Call to undefined function password_policy_constraint_uppercase_validate()".

The function in question is in an include file in the constraints subdirectory, located inside the module's directory. I've tried adding to the test's setUp() function, along the lines of:

drupal_load('module', 'password_policy');
module_load_include('inc', 'password_policy', 'constraint_uppercase');


I've also tried adding the module_load_include line inside the individual test method generating the error. However, none of my attempts so far appear to be working and the error still persists.

How should I go about loading the ./constraints/constraint_uppercase.inc and other include files, so that the necessary functions are loaded prior to the tests being run?
You have a flaw in your code, module_load_include works by including files relative to the module base dir, so you should do

module_load_include('inc', 'password_policy', 'constraints /constraint_uppercase');


to include password_policy/constraints/constraint_uppercase.inc

When you do

module_load_include('inc', 'password_policy', 'constraint_uppercase');


You instead try to include password_policy/constraint_uppercase.inc which doesn't exist.