Test helper

the test helper class, used to reduce code and increase efficiency


general information

A test helper class provides re-usable code for test classes to create standard objects and initialize variables that are frequently used. Examples of operations that might be included in a test helper class are creating records (account, opportunity, contact, etc.), inserting custom settings (trigger settings, territory information, etc.), or querying for users. Bits of code that are recycle-able should be placed into the test helper class. 

General guidelines on what should be included in a test helper class include : 

  • Account, opportunity, and contact creation
  • User query based on role
  • Custom setting declaration 
  • All validation requirements for triggers and object modifications