[1.6.x] Imported custom user classes in tests depending on it

Without those imports, affected test files cannot be run
independently. Refs #21164.

Backport of ef22d512b5 from master.