1

We want to be able to level-up our testing and have found ApexMocks as a very helpful library that we can use for this purpose. I'm not sure if I can cover ALL the use cases but I hope it can help us test page controllers, triggers, relationships, formula fields, utilities, callouts, etc. The problem we are dealing with is that the library has 30+ classes and looks like we will have to add it to our managed package to be able to use it, which increases (or bloats) the code base, which is not ideal.

Now the question is: Can we use this library without including it in our managed package? Or is there a better alternative?

  • 3
    It may be more sophisticated than your use case calls for. I personally have found mocking to be fairly easy to implement without any framework most of the time. Could you come up with a simple example or two of how you're using it? That would make it a lot easier to give you any suggestions. – Adrian Larson Apr 3 '18 at 19:10
  • @AdrianLarson Added some details. The link below is a question we asked about using Stub API that will be replaced by ApexMocks as an example: salesforce.stackexchange.com/questions/212184/… – Jorjani Apr 3 '18 at 19:16
2

No, any code you want to use needs to be deployed. However, if someone (presumably FinancialForce) stepped up and made their package a managed package, then you'd be able to build your code as an extension package. This would actually be ideal if multiple developers started using the same framework, because there'd be a collaborative benefit for everyone. However, this would make the setup less ideal in the sense that customers would need to install two packages for all packages that use the base (but only once if there were multiple packages that all shared the same package).

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.