You need to sign in to do that
Don't have an account?
Urgent: Even with 100% code coverage, Trigger is not getting deployed
Hi All,
I have the following trigger
trigger upsertmanagername on RMG_Employee_Allocation__c (after update)
{
List<RMG_Employee_Master__c> opps = new List<RMG_Employee_Master__c>();
List<ID> masterIds = new List<ID>();
Map<ID, String> childDetailMap = new Map<ID, String>();
for(RMG_Employee_Allocation__c c: Trigger.new)
{
masterIds.add(c.RMG_Employee_Code__c);
childDetailMap.put(c.RMG_Employee_Code__c, (c.Manager_Name__c));
}
opps = [select id, Current_Manager__c from RMG_Employee_Master__c where id in :masterIds];
for(RMG_Employee_Master__c rem: opps)
{
rem.Current_Manager__c = childDetailMap.get(rem.id);
Update rem;
}
if(opps.size() > 0)
Update opps;
}
And i have the following Apex Test class that has 100 % code covered in sandbox. But when i try deploying it to production i get an error: "Code coverage is 0% atleast 1% code coverage is required"
@isTest
private class Testupsertmanagername
{
static testMethod void testTrigger()
{
RMG_Employee_Master__c rmg = new RMG_Employee_Master__c(Name='Test');
insert rmg;
RMG_Employee_Allocation__c rmgallo = new RMG_Employee_Allocation__c(
Name='Test', Manager_Name__c='Unit Test',
RMG_Employee_Code__c=rmg.id);
insert rmgallo;
update rmgallo;
RMG_Employee_Master__c newrmg=[select Name, Current_Manager__c from RMG_Employee_Master__c where id = :rmgallo.id];
System.assertEquals('Unit Test', newrmg.Current_Manager__c);
}
}
Please help
A few obvious things to check:
(1) Are you deploying the trigger and the test class together?
(2) Is the "code coverage is 0%" definitely associated with the trigger you are deploying?
(3) Are you getting any errors/exceptions when the unit tests are executed?
All Answers
A few obvious things to check:
(1) Are you deploying the trigger and the test class together?
(2) Is the "code coverage is 0%" definitely associated with the trigger you are deploying?
(3) Are you getting any errors/exceptions when the unit tests are executed?
absolutely i was not deploying the trigger and the test class together... :)
Dear I think u are making mistake in deployment are u sending both trigger and test class in same package, same problem I was facing before some days so try to deploy both in the same package I mean add both in same package n the deploy it in production environment.
Regards,
Rathore Kuldeep
Hey NANCY, if you're posting the same question in multiple posts, and you receive an answer that works in one posting, please cancel or update the other posting so that other folks (like me) don't waste time answering something you've already dealt with. -Steve.
Hi Steve,
I shall keep your suggestion in mind.... Thanks