I wrote a trigger that works perfectly in the Sandbox, and seems to test ok (no errors when running test), but I can't deploy because the Force.com IDE says "Test coverage of selected Apex Trigger is 0%.." What am i missing? Code below. Appreciate any help! I'm new to all this :) Thanks!
================================ Here's my trigger code:
trigger AddNewProducts on Opportunity (after insert) {
List<BC_Product__c> Childs = new List<BC_Product__c>();
for(Opportunity a : trigger.new)
if (a.RecordTypeID == '012600000009MuX')
{
BC_Product__c Child = new BC_Product__c ();
Child.Opportunity__c = a.id;
Child.Account__c = a.AccountId;
Child.Product_Description__c = 'HTTP Caching (CDS - Global)';
Child.Provider__c = '001P000000mQ6RM';
Child.Type__c = 'New';
Child.Previous_MRC__c = 0;
Child.Status__c = 'Pending Contract';
Child.Qty_Units__c = 0;
Child.Unit_of_Measure__c = 'GB';
Child.Unit_Price__c = .009;
Child.Burstable_Rate__c = .009;
Child.CR_Install_Date__c = date.Today();
Childs.add(Child);
BC_Product__c Child1 = new BC_Product__c ();
Child1.Opportunity__c = a.id;
Child1.Account__c = a.AccountId;
Child1.Product_Description__c = 'HTTPS Secure Asset Delivery (SSL - Global)';
Child1.Provider__c = '001P000000mQ6RM';
Child1.Type__c = 'New';
Child1.Previous_MRC__c = 0;
Child1.Status__c = 'Pending Contract';
Child1.Qty_Units__c = 0;
Child1.Unit_of_Measure__c = 'GB';
Child1.Unit_Price__c = .009;
Child1.Burstable_Rate__c = .009;
Child1.CR_Install_Date__c = date.Today();
Childs.add(Child1);
BC_Product__c Child2 = new BC_Product__c ();
Child2.Opportunity__c = a.id;
Child2.Account__c = a.AccountId;
Child2.Product_Description__c = 'Aggregate Commit';
Child2.Provider__c = '001P000000mQ6RM';
Child2.Type__c = 'New';
Child2.Previous_MRC__c = 0;
Child2.Status__c = 'Pending Contract';
Child2.Qty_Units__c = 100000;
Child2.Unit_of_Measure__c = 'GB';
Child2.Unit_Price__c = .009;
Child2.Burstable_Rate__c = .009;
Child2.CR_Install_Date__c = date.Today();
Childs.add(Child2);
}
insert Childs;
}
=============================== And my test class:
@isTest
public class TestAddNewProducts {
static testMethod void insertNewOpportunity() {
Opportunity testOpportunity = new Opportunity(
RecordTypeID = '012600000009MuX',
AccountID = '0016000000zKiS7',
Name = 'Test Opportunity Triggers',
CloseDate = date.Today(),
StageName = '1 - Account Planning',
Type='New Customer',
Existing_Customer_Category__c='New Service / Product'
);
insert testOpportunity;
Test.startTest();
update testOpportunity;
Test.stopTest();
}
}
=================================