Menu Bar

Monday 20 October 2014

How to run the test class of Managed Package



Lets take a scenario when Managed package Class or Trigger is deployed in customer organization.
When  customer writes the new Trigger and used the managed package in the new Trigger the test for that new Trigger will show the exception

For this kind of scenarios you need to follow the below three as Managed package only runs in the three scenarios
·         On package upload (only applicable to the package author)
·         If explicitly selected to run (changing the namespace on the run dialog for Setup > Develop > Apex Test Execution, dev console, specific API calls to run them, like setting runTests in the metadata API deploy call).
·         On metadata API deployments that have the runAllTests flag set to true (see the runAllTests description).


@isTest(seealldata=true)
public class UpdateIMLocationTest {
    public static testMethod void myTest(){

 ******
 ******
 ******
 ******
PACKAGENAME__OBJECTNAME__c ** = new PACKAGENAME__OBJECTNAME__c
 ******   
}