function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
lucky013219147071527237lucky013219147071527237 

can u please help me how to write this trigger test class

trigger controlaAreaTalhaoAutomaticoBefore on Talhao__c (before insert, before update) {
    for(Talhao__c talhao:Trigger.new){
        if(talhao.Impede_Trigger_Area_Talhao_Automatico__c){
            Util.impedeTriggerAreaTalhaoAutomatico = true;
            talhao.Impede_Trigger_Area_Talhao_Automatico__c = false;
        }
        if(talhao.Area_do_Talhao__c == null || talhao.Area_do_Talhao__c < 0)
            talhao.addError('Área do Talhão: Inserir um valor positivo.');
    }
}
Guru@SfCloudGuru@SfCloud
Hi Lucky,

first provide the data staticly to Talhao__c object and perform insert  and update operation .
lucky013219147071527237lucky013219147071527237
can u please write the code
Guru@SfCloudGuru@SfCloud
@isTest Private class TalhaoClass{ Private static testMethod Void TalhaoClass(){ Talhao__c th = new Talhao__c (); Th.Name = 'FirstTest'; Manadatory fileds in thalho insert th; th.name = 'second test'; update th; } }