You need to sign in to do that
Don't have an account?

Help Needed For Test Class...
I have the following test script:
@isTest
public class theBatchLoadTest{
public static testMethod void testMyController() {
BatchLoadDaily controller = new BatchLoadDaily('fm017104');
Database.executeBatch(controller, 20);
}
}
Which tests the following:
global class BatchLoadDaily implements Database.Batchable<sObject> {
global final String bdId;
global BatchLoadDaily(String bdId) {
this.bdId = bdId;
}
global Database.QueryLocator start(Database.BatchableContext bc) {
return Database.getQueryLocator('SELECT payout__PrimaryKey__c, payout__Account_Desc__c, payout__Account_Opening__c, payout__Account_Type__c, payout__Albridge_ID__c, payout__Asset_Fund_Name__c, payout__Asset_Type__c, payout__BD_Id__c, payout__Cirrus_Source__c, CreatedById, CreatedDate, payout__CumDisc__c, payout__Cusip__c, payout__Dealer__c, payout__DealerBranch__c, IsDeleted, payout__Financial_Account_Number__c, payout__FirstName__c, payout__IRS_Code__c, Name, LastModifiedById, LastModifiedDate, payout__LastName__c, payout__Last_Price__c, payout__Last_Price_Update__c, payout__Market_Value__c, payout__MiddleName__c, payout__Num_Of_Shares__c, OwnerId, payout__Payout_Date__c, payout__PersonMailingCity__c, payout__PersonMailingStateProv__c, payout__PersonMailingStreet__c, payout__PersonMailingZip__c, payout__PersonOtherPhone__c, payout__Phone__c, payout__Plan_Status_Code__c, ConnectionReceivedId, Id, payout__Registration_Line_1__c, payout__Registration_Line_2__c, payout__Registration_Line_3__c, payout__Registration_Line_4__c, payout__SSN__c, payout__SSN_Financial_Account__c, ConnectionSentId, payout__Shares__c, payout__Sponsor_Name__c, payout__Symbol__c, SystemModstamp, payout__Systematic_Plan_Type__c, payout__Tax_Status__c, payout__UniqueId__c, payout__Valuation_Date__c, payout__RepId__c FROM payout__ImportStaging__c where payout__BD_Id__c = \'' + String.escapeSingleQuotes(bdId) + '\' AND payout__Processed_Flag__c <> \' Y \'');
}
global void execute(Database.BatchableContext bc, List<payout__ImportStaging__c> scope) {
System.Debug('Get in void execute');
}
But for some reason the global void execute code is NOT getting run (tested). Any ideas?.... The query does return rows to the getQueryLocator, but then the test stops and no more code is tested/covered.
Thanks so much for any help!
-Jim
Hi JimmyMac,
Before executing the batch in test class, you need to insert some test data(for payout__ImportStaging__c) in test class.
After insert run the batch.
All Answers
Hi JimmyMac,
Before executing the batch in test class, you need to insert some test data(for payout__ImportStaging__c) in test class.
After insert run the batch.
I feel like an idiot... Of course thats it!... Geezus what a brain fart. Thanks.