I am New to Create Managed Package. Is it required to create or do have test classes before creating managed package ?
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.
- 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.
- When deploying to production, all tests in your org's namespace will be run. Managed tests will not be run by default.
- If the deployment package explicitly marks
runAllTeststo 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.