Skip to content

Test failure: required field missing

Detection

  • RegExp: REQUIRED_FIELD_MISSING, Required fields are missing: \[([^\]]*)\]
  • Applies to: Apex test failures

Examples

  • System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Invoice_Date__c]: [Invoice_Date__c]

Resolution

The test data misses fields required in the target org: {1}
- Set {1} in the test data
- Run the test class on your org before publishing: sf hardis:org:test:apex

Comments