I've looked at a few questions but couldn't find the responses that worked for me. I've attached a screenshot of my classes and all of their code coverage. Any class ending in test is a test class.
Salesforce is counting my test classes as coverage. I'm at 59% according to them but 72% with non-test classes included.
I've included a test class example to see if there is something I did wrong.
@isTest
public class MobileActivityControllerTest {
static testmethod void testExistingWorkday(){
mobileActivityController mobile = new mobileactivityController();
mobile.geoLat = 0.0;
mobile.geoLong = 0.0;
mobile.owner = [select id, name from user limit 1];
mobile.startWorkday();
mobile.endWorkday();
workday__c myWd = createWorkday();
insert myWd;
list<Activity__c> myActs = createActivities(myWd);
insert myActs;
mywd.Work_Date__c = date.today();
update mywd;
mobile.endWorkday();
}
static list<activity__C> createActivities(workday__c wd)
{
list<activity__c> myActs = new list<activity__c>();
myActs.add(new Activity__c(workday__c = wd.Id, end_workday_activity__c = true));
myActs.add(new Activity__c(workday__c = wd.Id, start_workday_activity__c = true));
myActs.add(new Activity__c(workday__c = wd.Id,
city__c = 'madison',
zip_code__c = '35344',
check_in_time__c = datetime.valueOf('1954-01-01 20:03:20'),
check_out_time__c = datetime.valueOf('1954-01-01 20:03:20'),
GeoCode__Latitude__s = -2.0,
GeoCode__Longitude__s = -2.0));
myActs.add(new Activity__c(workday__c = wd.Id));
return myActs;
}
static workday__c createWorkday()
{
workday__c myWD = new workday__c();
myWd.Name = 'asdf';
mywd.Work_Date__c = date.valueof('1954-01-01');
myWd.OwnerId = UserInfo.getUserId();
return myWd;
}
}
UPDATE: