1

I am New to Create Managed Package. Is it required to create or do have test classes before creating managed package ?

4

When creating a managed package, prior to uploading you need to have test methods that meet the 75% coverage while in the packaging org. If they pass the managed package can be created

So the answer is yes

When installing in the destination org the tests are not run and are not required or expected to pass since configuration in destination orgs vary.

  • "When installing in the destination org the tests are not run and are not required or expected to pass since configuration in destination orgs vary." are you sure about this? We've had customers that could not install one of our managed package because some metadata in their org was causing the tests in the package to fail... of course we had to rapidly make our tests more robust – mkorman Feb 15 '17 at 13:51
  • That was the "Old Way" They are not run – Eric Feb 15 '17 at 13:58
  • @mkorman - Note that my statement was overly broad. There are cases where they are ran but they are not normally ran normally.... – Eric Feb 15 '17 at 14:30
1
  1. Managed package code is not included in the required code coverage calculation for deployment. The 75% requirement is on all Apex code in your org's namespace. Managed code has its own namespace, so it is not included.
  2. When deploying to production, all tests in your org's namespace will be run. Managed tests will not be run by default.
  3. If the deployment package explicitly marks runAllTests to true, managed tests will also run. These will need to execute without any failures should the flag be set. Despite this, the 75% requirement for code coverage is still only on unmanaged code.
  • I think this question is in the context of creating a new managed package, so the code coverage goal is for the code in the package (which will be managed) – mkorman Feb 15 '17 at 13:50

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.