I'm very noob and I'm writing a simple trigger (and I need to know if it works before re-writing in bulk mode). So, in order to have the trigger deployed, I wrote a simple (not useful) test class, but I still get this error:
Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required
TRIGGER:
trigger UpdateQuotationRollups on Q_Product__c (after insert, after undelete, after update){
Quotation__c theParent = [SELECT Name, Agent_hours__c from Quotation__c
where Id = :Trigger.newMap.keySet()];
AggregateResult a = [SELECT SUM(Agent_hour__c)somma
From Q_Product__c WHERE Quotation__c=:theParent.id];
Decimal ore = 0;
String str = '' + a.get('somma');
ore = Decimal.ValueOf(str);
theParent.Agent_hours__c = ore;
}
CLASS:
@isTest
public class testUpdateQuotationRollupsTrigger {
static testMethod void insertNewChild() {
Q_Product__c nuovochild =
new Q_Product__c(Name='fortestChilds',Quotation__c = 'a0WD000000EbSpu');
insert nuovochild;
}
}