CustomMetadataSaver icon indicating copy to clipboard operation
CustomMetadataSaver copied to clipboard

Add workaround for automatically testing the repo

Open jongpie opened this issue 3 years ago • 1 comments

Salesforce does not currently allow the metadata deploy method to be executed in a unit test - that makes this repo nearly impossible to properly test using Apex tests. As a possible workaround,

  1. Create an 'extra tests' folder that is only used by the pipeline (similar to Apex-Rollups)
  2. Include a flow in that folder that uses the invocable methods - this will serve as the 'test'
  3. In the repo's pipeline, deploy all metadata to a scratch org (including the extra folder)
  4. Run an apex script to execute the flow, and check the deployment ID for any errors. If any errors occur, fail the build.

jongpie avatar Mar 03 '21 00:03 jongpie

It ain't pretty, but it sure doth work

jamessimone avatar Mar 03 '21 00:03 jamessimone