• fbell
  • NEWBIE
  • 0 Points
  • Member since 2005

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
I have a basic Custom Controller working fine on my sandbox but I'm having the most difficult time getting any code coverage %.  I can't tell what I have to do in order to get this covered to 75% because it is at 0% no matter what I have done now even though I have ran the following test or a variation of it successfully.

----

@isTest
private class changeCapacityControllerTestClass {
    static testMethod void changeCapacity() {
       //setdate = datetime.newInstance(1960, 2, 17);
       date myDate = date.newInstance(1960, 2, 17);
       Socket__c s = new Socket__c(Availability_Zone__c='a13e0000000g8QI', Activation_Date__c=mydate,Socket_Additions__c=33 );
       System.debug('AvailZone ' + s.Availability_Zone__c);
       System.debug('Activation Date: ' + s.Activation_Date__c);
       System.debug('sockets' + s.Socket_Additions__c);
       System.debug('Nothing: ' + 'blah');   

       // Insert
       insert s;
   
       // Retrieve the new Socket Addition
       s = [SELECT Socket_Additions__c FROM Socket__c WHERE Activation_Date__c =:s.Activation_Date__c];
       System.debug('Socket Count after this was ran: ' + s.Socket_Additions__c);

       // Test that the stuff worked
       //System.assertEquals('a13e0000000g8QI', s.Availability_Zone__c);
       System.assertEquals(33, s.Socket_Additions__c);
       System.assertEquals(mydate, s.Activation_Date__c);                    
    }
}
  • May 19, 2014
  • Like
  • 0