• nehakumari
  • NEWBIE
  • 35 Points
  • Member since 2015
  • Simplilearn


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
Hi All,

Can someone please explain the difference between "percent" and "percent-fixed"? Also when to use which amon these two.
I am confused over here.

Thanks in Advance,
SFDC Alex
I have inherited a Test Class that covers two triggers in my org.

When I run the Test Class is the Sandbox Developer Console, I have 77% and 76% code coverage for the triggers.

When I try to deploy the triggers to production, they fail with code coverage of 10% and 7&.

The Test Class uses seealldata=true, and I believe this is why the code coverage fails in production, but I do not know how to update this test to get the necessary coverage.

Here is the Test Class:

@isTest(SeeAllData=true)
private class PulseTriggerTests {
 
    static testMethod void doTests() {
       
        WebServiceCallout.isApexTest = true;
       
        //Insert placement
        Unicore_Placement__c placement = new Unicore_Placement__c();
        placement.Name = 'TestPlacement';
        placement.Pulse_ID__c = '1';
       
        insert placement;
       
        //Insert Account
        Account a = new Account();
        a.Name = 'TestAccount';
        a.Type__c = 'Customer';
        a.UNGST_Prop_Code__c = 'TestAccount';
        a.Name_on_Sign__c = 'TestAccount';
        a.Flag_Prop_Code__c = '1';
        a.Brand_Name__c = 'Hilton';
        //a.Pulse_Environments_To_Sync__c = 'Staging;Demonstration;Development';
       
        insert a;
       
        //Insert Asset
        Asset s = new Asset();
        s.Name = 'TestAsset';
        s.AccountId = a.Id;
        s.Status = 'Installed';
        s.Asset_Type__c = 'Business Center';
        s.Active__c = true;
        //s.Pulse_Environments_To_Sync__c = 'Staging;Demonstration;Development';
       
        insert s;
       
        s.Asset_Type__c = 'Tradeshow Screensaver';
        update s;
       
        s.Asset_Type__c = 'CP Business Center';
        update s;
       
        s.Asset_Type__c = 'Boarding Pass';
        update s;
       
        s.Placement__c = placement.Id;
        s.Asset_Type__c = 'Concierge Station';
        update s;
       
        s.Asset_Type__c = 'Chalkboard';
        update s;
       
        s.Asset_Type__c = 'Information Board';
        update s;
       
        s.Active__c = false;
        update s;
    }
   
    public static testMethod void test_sendPulseNotification()
    {
        WebServiceCallout.isApexTest = true;
       
        Pulse_Sync_Status__c status = new Pulse_Sync_Status__c();
       
        status.Item_ID__c = '1';
        status.Object_Type__c = 'Account';
       
        insert status;
       
        Map<String,String> headers;
        WebServiceCallout.sendPulseNotification('', '400-code', 'POST', headers, status.Id, 'Production');
    }
   
    // run WebServiceCallout.testMe(); from Execute Anonymous to test
    public static testMethod void test_logError()
    {      
        //No existing error
        WebServiceCallout.logError('1', 'Error', 'Production');
       
        //Make a status
        Pulse_Sync_Status__c status = new Pulse_Sync_Status__c();
       
        status.Item_ID__c = '1';
        status.Object_Type__c = 'Account';
       
        insert status;
       
        //Error already exists
        WebServiceCallout.logError(status.Id, 'Error 2', 'Production');
    }
   
    public static testMethod void test_logSuccess()
    {      
        Pulse_Sync_Status__c status = new Pulse_Sync_Status__c();
       
        status.Item_ID__c = '1';
        status.Object_Type__c = 'Account';
        status.Last_Message__c = 'Error';
       
        insert status;
       
        WebServiceCallout.logSuccess(status.Id, 'Success', 'Production');
    }
   
    public static testMethod void test_logUnregistered()
    {      
        Pulse_Sync_Status__c status = new Pulse_Sync_Status__c();
       
        status.Item_ID__c = '1';
        status.Object_Type__c = 'Account';
        status.Last_Message__c = 'Error';
       
        insert status;
       
        WebServiceCallout.logUnregistered(status.Id, 'Success', 'Production');
    }
}
 
Hi All,

Can someone please explain the difference between "percent" and "percent-fixed"? Also when to use which amon these two.
I am confused over here.

Thanks in Advance,
SFDC Alex