We are using sobject settings in our package. Is it possible to create metadata sobject in the unit test?

  • sobject settings? do you mean custom metadata types? – salesforce-sas Aug 2 '19 at 9:44
  • Nope, create sobject that doesn't exist in the system. – Eugene Vabishchevich Aug 2 '19 at 10:12
  • I am afraid it is not possible. Unit tests are run in as context of current environment status (with recent changes during deployment), but they do not allow to make changes into model (at least for now). It might be a good reason to revisit unit tests in order to cover smaller pieces of logic instead of whole process, that includes data model changes. Apex Stub API (developer.salesforce.com/docs/atlas.en-us.apexcode.meta/…) could also help in that – kurunve Aug 2 '19 at 10:44
  • @kurunve that seems like a good answer to this question - would you like to post an answer? – David Reed Aug 4 '19 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.