I searched through web but didn't find a clear answer to this. What happens when a managed package is installed? Do test classes execute at the time of managed package installation?
2 Answers
When managed packages are installed or upgraded, tests are not run. (If they were they would very likely fail because of e.g. local validation rules and other logic that interfere with the managed package tests.) Test classes will only be executed while you are creating a managed package. i.e. when you hit the "upload" button.
There is a specific annotation that allows tests cases from the managed packages to run on install @IsTest(OnInstall=true)
.
It will force either a single test method or entire class to run.
Otherwise, no tests from the managed package run during install.