function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Andrea_NerightAndrea_Neright 

IDE test coverage 100% but 0% in salesforce

I have a couple of triggers on the Opportunity standard object (before and after update) which send an email and do a couple of field update.

 

I wrote a test class using Eclipse IDE. Once I run that test class I get 100% test coverage on both the triggers, however when I deploy it into my sandbox instance I get 0% on both.

 

Any advice ?

 

Below my class

 

@isTest(SeeAllData=true)
private class TestOpportunityApproval {

    static testMethod void myUnitTest() {
         
	Account account = new Account();
        account.name = 'Test Account';
        account.BillingCountry = 'myNewCountry';
        insert account;
        
        Pricebook2  standardPb = [select id, name, isActive from Pricebook2 where IsStandard = true limit 1];
        
        Pricebook2 pbk1 = new Pricebook2 (Name='Test Pricebook Entry 1',Description='Test Pricebook Entry 1', isActive=true);
		insert pbk1;

        Product2 prd1 = new Product2 (Name='Test Product Entry 1',Description='Test Product Entry 1',productCode = 'ABC',            isActive = true); 
insert prd1; PricebookEntry pbe1 = new PricebookEntry (Product2ID=prd1.id,Pricebook2ID=standardPb.id,UnitPrice=50, isActive=true); insert pbe1; Opportunity opp = new Opportunity (Name='Test_class',StageName='Prospecting',CloseDate=Date.today(),Pricebook2Id = pbe1.Pricebook2Id, AccountId = account.id ,Project_Type__c='eDiscovery',LeadSource='List',Type='New Customer - New Business',RejectionReason__c=null); insert opp; OpportunityLineItem lineItem1 = new OpportunityLineItem (OpportunityID=opp.id,PriceBookEntryID=pbe1.id, quantity=4, totalprice=200); insert lineItem1; test.startTest(); opp.RejectionReason__c='This is a test message'; opp.StageName='Order Obtained'; update opp; System.assertEquals(Opp.StageName,'Order Obtained'); test.stopTest(); } }

 

 

 

Prafull G.Prafull G.
In last release, there are few issues with Code Coverage. Check the following URL
https://success.salesforce.com/issues_index?keywords=code%20coverage

Hope it helps.
zachbarkleyzachbarkley

Hi Andrea,

 

Did you release the following from your sandbox:

 

1) Trigger Class

2) Apex Class (if using a handler)

3) Test Class (Which covers the above 2)

 

 

Andrea_NerightAndrea_Neright

Nothing related to my situation...