jongpie / CustomMetadataSaver

Allows saving changes to custom metadata records via Apex and Flow
MIT License
39 stars 5 forks source link

Add workaround for automatically testing the repo #7

Open jongpie opened 3 years ago

jongpie commented 3 years ago

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.
jamessimone commented 3 years ago

It ain't pretty, but it sure doth work