@isTest private class ProductSetTriggerTest { static testMethod void myUnitTest() { Product_Set__c oldpara = new Product_Set__c(); insert oldpara; Product_Set_Detail__c referObj = new Product_Set_Detail__c( Product_Set__c = oldpara.Id, //Product__c = 'test', //Total_price_RMB__c = 66, List_price_total_RMB_text__c = 77, Quantity__c = 20); insert referObj; Product_Set__c para = new Product_Set__c(RefertoID__c = oldpara.Id); insert para; List listpara = new List (); listpara.add(para); ProductSetTrigger.CopyProductSetDetail(listpara,null,null,null); List result = [select Product_Set__c, Product_SFDA_Status__c,Product__c,Total_price_RMB__c, List_price_total_RMB_text__c,Quantity__c from Product_Set_Detail__c where Product_Set__c =: para.Id]; system.debug('result===========> '+result); System.assertEquals(result[0].Quantity__c, 20); //System.assertEquals(result.Product_SFDA_Status__c, '停止'); } }