Try this: ... // Omitted first 8 lines Map<Id, Case> newCases = new Map<Id, Case>([SELECT Product__r.Name FROM Case WHERE Id IN :Trigger.NEW]); for(Integer i =0; i< Trigger.size; i++){ if(Trigger.isUpdate){ Boolean condition = Trigger.new[i].IsClosed; condition = condition &&(newCases.get(Trigger.new[i].Id).Product__r.Name == 'TEST_PRODUCT'); // Id 01td0000000yFguAAE is for TEST_PRODUCT product condition = condition && (Trigger.old[i].Campaign_End_Date__c != Trigger.new[i].Campaign_End_Date__c); // The rest of your trigger code ... and the product that you create for your test should be: Product2 testProduct = new Product2(Name = 'TEST_PRODUCT'); insert testProduct; Case testCase = new Case(Product__c = testProduct.Id);