@isTest public with sharing class EquipmentDraftOnceYearBatchTest { static testMethod void myUnitTest1() { //备品借出申请 Rental_Apply__c raObj = new Rental_Apply__c(); raObj.Name = 'testra'; raObj.Status__c = '草案中'; raObj.Product_category__c = 'GI'; raObj.Demo_purpose1__c = '产品试用'; raObj.direct_send__c = '医疗机构'; raObj.Loaner_received_staff__c = '王五'; raObj.Loaner_received_staff_phone__c = '110'; raObj.direct_shippment_address__c = '北京市'; raObj.Hope_Lonaer_date_Num__c = 1; // 希望借用天数 raObj.Phone_number__c = '1234567890'; raObj.Follow_pcl_status2_Text__c = '引合 : -'; raObj.demo_purpose2__c = '其他' ; insert raObj; System.Test.StartTest(); Id execBTId1 = Database.executeBatch(new EquipmentDraftOnceYearBatch(raObj.id), 10); Database.executeBatch(new EquipmentDraftOnceYearBatch(), 10); EquipmentDraftOnceYearBatch.test(); System.Test.StopTest(); } }