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
EvertonSzekeresEvertonSzekeres 

Test class

Hi,

 

I'm trying create a test class for this trigger:

 

trigger DeleteTask_Solicitacao_Pagamento on Case (after update){
           
    Set <id> ids = new Set <id> ();
    for (Case c: trigger.new) {
        if (c.motivo__c == 'Solicitação de Pagamento' && c.status <> 'Fechado') {
            ids.add(c.id);
        }
    }  
             
  for (Case c: trigger.new) {
      if ((c.Quantas_PP_s_pagamento__c >= 1 || c.Quantidade_de_PP_s_Estojo__c >= 1) && (c.Tipo_de_solicita_o__c != 'Despesas com equipe de vendas' && c.Tipo_de_solicita_o__c != 'Cache' && c.Tipo_de_solicita_o__c != 'Mostruarios' && c.Tipo_de_solicita_o__c != 'Devolução de venda' && c.Tipo_de_solicita_o__c != 'Laboratórios por fora do sistema' && c.Tipo_de_solicita_o__c != 'Devolução de venda' && c.Tipo_de_solicita_o__c != 'Divisão de resultados')){
      if(ids.size()>0){
          for (Task t: [SELECT Id, description, Solicita_o_de_Pagamento__c FROM Task WHERE (subject = 'Solicitação de Pagamento - Lançar PP' OR subject = 'Solicitação de Pagamento - Baixar PP') AND status != 'Concluído' AND whatid IN: ids]){
          t.description = c.tipo_de_pagamento__c;
          t.Solicita_o_de_Pagamento__c = c.Tipo_de_solicita_o__c;
         update t;
         }
      }
      }      
      if ((c.Quantas_PP_s_pagamento__c < 1 || c.Quantas_PP_s_pagamento__c == null) && (c.Quantidade_de_PP_s_Estojo__c < 1 || c.Quantidade_de_PP_s_Estojo__c == null)){
      for (Task t: [SELECT whatid, subject, status FROM Task WHERE subject = 'Solicitação de Pagamento - Lançar PP' AND status != 'Concluído' AND whatid IN: ids]){
      delete t;
          }
      }
      if (c.Nota_fiscal__c == 'SIM' && (c.Tipo_de_solicita_o__c != 'Despesas com equipe de vendas' && c.Tipo_de_solicita_o__c != 'Cache' && c.Tipo_de_solicita_o__c != 'Mostruarios' && c.Tipo_de_solicita_o__c != 'Laboratórios por fora do sistema' && c.Tipo_de_solicita_o__c != 'Devolução de venda' && c.Tipo_de_solicita_o__c != 'Divisão de resultados')){
      if(ids.size()>0){
          for (Task t: [SELECT description, Solicita_o_de_Pagamento__c FROM Task WHERE subject = 'Solicitação de Pagamento - Solicitar Nota Fiscal' AND status != 'Concluído' AND whatid IN: ids]){
          t.description = c.tipo_de_pagamento__c;
          t.Solicita_o_de_Pagamento__c = c.Tipo_de_solicita_o__c;
         update t;
         }
      }
      }
      if (c.Nota_fiscal__c != 'SIM'){
      if(ids.size()>0){
          for (Task t: [SELECT whatid, subject, status FROM Task WHERE subject = 'Solicitação de Pagamento - Solicitar Nota Fiscal' AND status != 'Concluído' AND whatid IN: ids]){
      delete t;
          }
      }
      }
      if ((c.forma_de_pagamento__c == 'MALOTE' || c.forma_de_pagamento__c == 'DEPÓSITO + MALOTE') && c.Tipo_de_solicita_o__c != 'Despesas com equipe de vendas' && c.Tipo_de_solicita_o__c != 'Cache' && c.Tipo_de_solicita_o__c != 'Mostruarios' && c.Tipo_de_solicita_o__c != 'Devolução de venda' && c.Tipo_de_solicita_o__c != 'Laboratórios por fora do sistema' && c.Tipo_de_solicita_o__c != 'Devolução de venda' && c.Tipo_de_solicita_o__c != 'Divisão de resultados'){
      if(ids.size()>0){
          for (Task t: [SELECT description, Solicita_o_de_Pagamento__c FROM Task WHERE subject = 'Solicitação de Pagamento - Malote' AND status != 'Concluído' AND whatid IN: ids]){
          t.description = c.tipo_de_pagamento__c;
          t.Solicita_o_de_Pagamento__c = c.Tipo_de_solicita_o__c;
         update t;
         }
      }
      }
       if (c.forma_de_pagamento__c != 'MALOTE' && c.forma_de_pagamento__c != 'DEPÓSITO + MALOTE'){
       if(ids.size()>0){
       for (Task t: [SELECT whatId, subject, status FROM Task WHERE subject = 'Solicitação de Pagamento - Malote' AND status != 'Concluído' AND whatid IN: ids]){
          delete t;
      }
       }
       }
       if ((c.Tipo_de_solicita_o__c == 'Despesas com equipe de vendas' || c.Tipo_de_solicita_o__c == 'Cache' || c.Tipo_de_solicita_o__c == 'Mostruarios' || c.Tipo_de_solicita_o__c == 'Laboratórios por fora do sistema' || c.Tipo_de_solicita_o__c == 'Devolução de venda' && c.Tipo_de_solicita_o__c == 'Divisão de resultados') && c.Forma_de_pagamento__c == 'MALOTE' && (c.Quantas_PP_s_pagamento__c == 0 || c.Quantas_PP_s_pagamento__c == null) && (c.Quantidade_de_PP_s_Estojo__c == 0 || c.Quantidade_de_PP_s_Estojo__c == null)){
       if(ids.size()>0){
          for (Task t: [SELECT Solicitar_Malote__c, Solicitar_Dep_sito__c, Solicitar_PP__c, Solicita_o_de_Pagamento__c, subject, Respons_vel_por_resolver_a_tarefa__c, ActivityDate, Ownerid FROM Task WHERE status != 'Concluído' AND whatid IN: ids]){
               t.Solicitar_Malote__c = true;
               t.Solicitar_Dep_sito__c = false;
               t.Solicitar_PP__c = false;
               t.Solicita_o_de_Pagamento__c = c.Tipo_de_solicita_o__c;
               t.Subject = 'Solicitação de Pagamento - Aprovar solicitação';
               t.Respons_vel_por_resolver_a_tarefa__c = 'CARLOS BALMA';
               t.ActivityDate = Date.today();
               t.Ownerid = '005U0000000FDE9';
         update t;
         }
         }
         }
      if ((c.Tipo_de_solicita_o__c == 'Despesas com equipe de vendas' || c.Tipo_de_solicita_o__c == 'Cache' || c.Tipo_de_solicita_o__c == 'Mostruarios' || c.Tipo_de_solicita_o__c == 'Laboratórios por fora do sistema' || c.Tipo_de_solicita_o__c == 'Devolução de venda' || c.Tipo_de_solicita_o__c == 'Divisão de resultados') && c.Forma_de_pagamento__c == 'DEPÓSITO + MALOTE' && (c.Quantas_PP_s_pagamento__c == 0 || c.Quantas_PP_s_pagamento__c == null) && (c.Quantidade_de_PP_s_Estojo__c == 0 || c.Quantidade_de_PP_s_Estojo__c == null)){
      if(ids.size()>0){
             for (Task t: [SELECT Solicitar_Malote__c, Solicitar_Dep_sito__c, Solicitar_PP__c, Solicita_o_de_Pagamento__c, subject, Respons_vel_por_resolver_a_tarefa__c, ActivityDate, Ownerid FROM Task WHERE status != 'Concluído' AND whatid IN: ids]){
               t.description = c.tipo_de_pagamento__c;
               t.Solicitar_PP__c = false;
               t.Solicitar_Malote__c = true;
               t.Solicitar_Dep_sito__c = true;
               t.Solicita_o_de_Pagamento__c = c.Tipo_de_solicita_o__c;
               t.Subject = 'Solicitação de Pagamento - Aprovar solicitação';
               t.Respons_vel_por_resolver_a_tarefa__c = 'CARLOS BALMA';
               t.ActivityDate = Date.today();
               t.Ownerid = '005U0000000FDE9';
         update t;
         }
         }
         }
        if ((c.Tipo_de_solicita_o__c == 'Despesas com equipe de vendas' || c.Tipo_de_solicita_o__c == 'Cache' || c.Tipo_de_solicita_o__c == 'Mostruarios' || c.Tipo_de_solicita_o__c == 'Laboratórios por fora do sistema' || c.Tipo_de_solicita_o__c == 'Devolução de venda' || c.Tipo_de_solicita_o__c == 'Divisão de resultados') && c.Forma_de_pagamento__c != 'MALOTE' && (c.Quantas_PP_s_pagamento__c > 0 || c.Quantidade_de_PP_s_Estojo__c > 0)){
        if(ids.size()>0){
            for (Task t: [SELECT Solicitar_Malote__c, Solicitar_Dep_sito__c, Solicitar_PP__c, Solicita_o_de_Pagamento__c, subject, Respons_vel_por_resolver_a_tarefa__c, ActivityDate, Ownerid FROM Task WHERE status != 'Concluído' AND whatid IN: ids]){
               t.description = c.tipo_de_pagamento__c;
               t.Solicitar_PP__c = true;
               t.Solicitar_Malote__c = false;
               t.Solicitar_Dep_sito__c = false;
               t.Solicita_o_de_Pagamento__c = c.Tipo_de_solicita_o__c;
               t.Subject = 'Solicitação de Pagamento - Aprovar solicitação';
               t.Respons_vel_por_resolver_a_tarefa__c = 'CARLOS BALMA';
               t.ActivityDate = Date.today();
               t.Ownerid = '005U0000000FDE9';
       update t;
        }
        }
        }
        if ((c.Tipo_de_solicita_o__c == 'Despesas com equipe de vendas' || c.Tipo_de_solicita_o__c == 'Cache' || c.Tipo_de_solicita_o__c == 'Mostruarios' || c.Tipo_de_solicita_o__c == 'Laboratórios por fora do sistema' || c.Tipo_de_solicita_o__c == 'Devolução de venda' || c.Tipo_de_solicita_o__c == 'Divisão de resultados') && c.Forma_de_pagamento__c == 'MALOTE' && (c.Quantas_PP_s_pagamento__c > 0 || c.Quantidade_de_PP_s_Estojo__c > 0)){
        if(ids.size()>0){
        for (Task t: [SELECT Solicitar_Malote__c, Solicitar_Dep_sito__c, Solicitar_PP__c, Solicita_o_de_Pagamento__c, subject, Respons_vel_por_resolver_a_tarefa__c, ActivityDate, Ownerid FROM Task WHERE status != 'Concluído' AND whatid IN: ids]){
            t.description = c.tipo_de_pagamento__c;
               t.Solicitar_PP__c = true;
               t.Solicitar_Malote__c = true;
               t.Solicitar_Dep_sito__c = false;
               t.Solicita_o_de_Pagamento__c = c.Tipo_de_solicita_o__c;
               t.Subject = 'Solicitação de Pagamento - Aprovar solicitação';
               t.Respons_vel_por_resolver_a_tarefa__c = 'CARLOS BALMA';
               t.ActivityDate = Date.today();
               t.Ownerid = '005U0000000FDE9';
      update t;
        }
        }
        }
        if ((c.Tipo_de_solicita_o__c == 'Despesas com equipe de vendas' || c.Tipo_de_solicita_o__c == 'Cache' || c.Tipo_de_solicita_o__c == 'Mostruarios' || c.Tipo_de_solicita_o__c == 'Laboratórios por fora do sistema' || c.Tipo_de_solicita_o__c == 'Devolução de venda' || c.Tipo_de_solicita_o__c == 'Divisão de resultados') && c.Forma_de_pagamento__c == 'DEPÓSITO + MALOTE' && (c.Quantas_PP_s_pagamento__c > 0 || c.Quantidade_de_PP_s_Estojo__c > 0)){        
        if(ids.size()>0){
        for (Task t: [SELECT Solicitar_Malote__c, Solicitar_Dep_sito__c, Solicitar_PP__c, Solicita_o_de_Pagamento__c, subject, Respons_vel_por_resolver_a_tarefa__c, ActivityDate, Ownerid FROM Task WHERE status != 'Concluído' AND whatid IN: ids]){
               t.description = c.tipo_de_pagamento__c;
               t.Solicitar_PP__c = true;
               t.Solicitar_Malote__c = true;
               t.Solicitar_Dep_sito__c = true;
               t.Solicita_o_de_Pagamento__c = c.Tipo_de_solicita_o__c;
               t.Subject = 'Solicitação de Pagamento - Aprovar solicitação';
               t.Respons_vel_por_resolver_a_tarefa__c = 'CARLOS BALMA';
               t.ActivityDate = Date.today();
               t.Ownerid = '005U0000000FDE9';
       update t;
        }
        }
        }
         if (c.Tipo_de_solicita_o__c == 'Despesas com equipe de vendas' || c.Tipo_de_solicita_o__c == 'Cache' || c.Tipo_de_solicita_o__c == 'Mostruarios' || c.Tipo_de_solicita_o__c == 'Laboratórios por fora do sistema' || c.Tipo_de_solicita_o__c == 'Devolução de venda' && c.Tipo_de_solicita_o__c == 'Divisão de resultados'){
         if(ids.size()>0){
         for (Task t: [SELECT whatId, subject, status FROM Task WHERE Subject != 'Solicitação de Pagamento - Aprovar solicitação' AND status != 'Concluído' AND whatid IN: ids]){
         delete t;        
      }
     }
     }
     }
}

 

Can anyone assist me?

 

Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
Abhi_TripathiAbhi_Tripathi

Hey Everton,

 

Mark that answer as correct with KUDOS , for help of others.

 

And to increase your code coverage, go to eclipse or console check which line is not covered than try to cover in the test class 

 

surely it will increase

All Answers

Abhi_TripathiAbhi_Tripathi

Hey Everton,

 

Go for this link, and try it yourself

 

http://abhithetechknight.blogspot.in/2013/10/salesforce-test-class-basics.html

EvertonSzekeresEvertonSzekeres

 

Thanks for your help.

 

I've been tried change my test class, but doesn't matter what I do.

I'm still getting 71%.

 

@IsTest(SeeAllData=true)
public class CriarTarefaCase_Solicitacao_Pag_test{
static testmethod void MyUnitTest(){
    
    User u = [select id from User where lastName='Marketing' limit 1];
    
     Case c = new Case(tipo_de_pagamento__c = 'TURMAS', motivo__c = 'Solicitação de Pagamento', Forma_de_pagamento__c = 'MALOTE', status = 'Novo', Quantas_PP_s_pagamento__c = 5, Quantidade_de_PP_s_Estojo__c = 5, Tipo_de_solicita_o__c  = 'Produtos');
     insert c;
    
    Task t1 = new Task(Status='Nenhum', Priority='Normal', whatId=c.id, subject='Solicitação de Pagamento - Malote', Solicita_o_de_Pagamento__c=c.Tipo_de_solicita_o__c , ownerid=u.id);
    insert t1;
    
    c.tipo_de_pagamento__c = 'TURMAS'; c.motivo__c = 'Solicitação de Pagamento'; c.Forma_de_pagamento__c = 'MALOTE'; c.Quantas_PP_s_pagamento__c = 5; c.Quantidade_de_PP_s_Estojo__c = 5; c.Tipo_de_solicita_o__c  = 'Produtos';
    update t1;
    
    c.forma_de_pagamento__c = 'DEPÓSITO EM CONTA'; 
    delete t1; 
    
    Case c1 = new Case(tipo_de_pagamento__c = 'DESPESAS', motivo__c = 'Solicitação de Pagamento', Forma_de_pagamento__c = 'DEPÓSITO + MALOTE', status = 'Novo', Quantas_PP_s_pagamento__c = 5, Quantidade_de_PP_s_Estojo__c = 5, Tipo_de_solicita_o__c  = 'Produtos');
     insert c1;
    
    Task tsk01  = new Task(Status='Nenhum', Priority='Normal', subject = 'Solicitação de Pagamento - Lançar PP', whatid=c1.id, Solicita_o_de_Pagamento__c=c1.Forma_de_pagamento__c, ownerid='005U0000001KrZy');
     insert tsk01;  
          
     c1.tipo_de_pagamento__c = 'DESPESAS'; c1.motivo__c = 'Solicitação de Pagamento'; c1.Forma_de_pagamento__c = 'DEPÓSITO + MALOTE'; c1.status = 'Novo'; c1.Quantas_PP_s_pagamento__c = 5; c1.Quantidade_de_PP_s_Estojo__c = 5; c1.Tipo_de_solicita_o__c  = 'Produtos';
     update tsk01;
     
    c1.Quantas_PP_s_pagamento__c = null; c1.Quantidade_de_PP_s_Estojo__c = null;
    delete tsk01;
    
    Task tsk11  = new Task(Status='Nenhum', Priority='Normal', subject = 'Solicitação de Pagamento - Baixar PP', whatid=c1.id, Solicita_o_de_Pagamento__c=c1.Forma_de_pagamento__c, ownerid='005U0000001KrZy');
     insert tsk11;
     
     c1.tipo_de_pagamento__c = 'DESPESAS'; c1.motivo__c = 'Solicitação de Pagamento'; c1.Forma_de_pagamento__c = 'DEPÓSITO + MALOTE'; c1.status = 'Novo'; c1.Quantas_PP_s_pagamento__c = 5; c1.Quantidade_de_PP_s_Estojo__c = 5; c1.Tipo_de_solicita_o__c  = 'Produtos';
     update tsk11;
     
    c1.Quantas_PP_s_pagamento__c = null; c1.Quantidade_de_PP_s_Estojo__c = null;
    delete tsk11;
    
    Task t02 = new Task(Status='Nenhum', Priority='Normal', whatId=c1.id, subject='Solicitação de Pagamento - Malote', Solicita_o_de_Pagamento__c=c1.Tipo_de_solicita_o__c , ownerid=u.id);
    insert t02;
    
    c1.tipo_de_pagamento__c = 'DESPESAS'; c1.motivo__c = 'Solicitação de Pagamento'; c1.Forma_de_pagamento__c = 'DEPÓSITO + MALOTE'; c1.status = 'Novo'; c1.Quantas_PP_s_pagamento__c = 5; c1.Quantidade_de_PP_s_Estojo__c = 5; c1.Tipo_de_solicita_o__c  = 'Produtos';
     update t02;
    
    c1.forma_de_pagamento__c = 'DEPÓSITO EM CONTA';
    delete t02;
    
    Case c001 = new Case(Tipo_de_solicita_o__c = 'Despesas com equipe de vendas', tipo_de_pagamento__c = 'DESPESAS', motivo__c = 'Solicitação de Pagamento', Forma_de_pagamento__c = 'MALOTE', status = 'Novo', Quantas_PP_s_pagamento__c = 5, Quantidade_de_PP_s_Estojo__c = 5);
    insert c001;
  
    Task t2 = new Task(description=c001.tipo_de_pagamento__c,Status='Nenhum', Priority='Normal', whatId=c001.id, subject='Solicitação de Pagamento - Aprovar solicitação', Solicita_o_de_Pagamento__c=c001.Tipo_de_solicita_o__c , ownerid=u.id, Solicitar_PP__c = true,Solicitar_Malote__c = true);
    insert t2;
    
    c001.Tipo_de_solicita_o__c = 'Despesas com equipe de vendas'; c001.tipo_de_pagamento__c = 'DESPESAS'; c001.motivo__c = 'Solicitação de Pagamento'; c001.Forma_de_pagamento__c = 'MALOTE'; c001.status = 'Novo'; c001.Quantas_PP_s_pagamento__c = 5; c001.Quantidade_de_PP_s_Estojo__c = 5;
    update t2;
    
    Task t12 = new Task(description=c001.tipo_de_pagamento__c,Status='Nenhum', Priority='Normal', whatId=c001.id, subject='Solicitação de Pagamento - Não aprovada', Solicita_o_de_Pagamento__c=c001.Tipo_de_solicita_o__c , ownerid=u.id, Solicitar_PP__c = true,Solicitar_Malote__c = true);
    insert t12;
    
    Case c002 = new Case(Tipo_de_solicita_o__c  = 'Despesas com equipe de vendas', tipo_de_pagamento__c = 'DESPESAS', motivo__c = 'Solicitação de Pagamento', Forma_de_pagamento__c = 'MALOTE', status = 'Novo', Quantas_PP_s_pagamento__c = 0, Quantidade_de_PP_s_Estojo__c = 0);
    insert c002;
  
    Task t3 = new Task(description=c002.tipo_de_pagamento__c,Status='Nenhum', Priority='Normal', whatId=c002.id, subject='Solicitação de Pagamento - Aprovar solicitação', Solicita_o_de_Pagamento__c=c002.Tipo_de_solicita_o__c , ownerid=u.id, Solicitar_Malote__c = true);
    insert t3;
    
    c002.Tipo_de_solicita_o__c = 'Despesas com equipe de vendas'; c002.tipo_de_pagamento__c = 'DESPESAS'; c002.motivo__c = 'Solicitação de Pagamento'; c002.Forma_de_pagamento__c = 'MALOTE'; c002.status = 'Novo'; c002.Quantas_PP_s_pagamento__c = 5; c002.Quantidade_de_PP_s_Estojo__c = 5;
    update t3;

    Task t13 = new Task(description=c002.tipo_de_pagamento__c,Status='Nenhum', Priority='Normal', whatId=c002.id, subject='Solicitação de Pagamento - Não aprovada', Solicita_o_de_Pagamento__c=c002.Tipo_de_solicita_o__c , ownerid=u.id, Solicitar_Malote__c = true);
    insert t13;
    
    Case c003 = new Case(Tipo_de_solicita_o__c  = 'Cache', tipo_de_pagamento__c = 'TURMAS', motivo__c = 'Solicitação de Pagamento', Forma_de_pagamento__c = 'DEPÓSITO + MALOTE', status = 'Novo', Quantas_PP_s_pagamento__c = 5, Quantidade_de_PP_s_Estojo__c = 5);
    insert c003;
  
    Task t4 = new Task(description=c003.tipo_de_pagamento__c,Status='Nenhum', Priority='Normal', whatId=c003.id, subject='Solicitação de Pagamento - Aprovar solicitação', Solicita_o_de_Pagamento__c=c003.Tipo_de_solicita_o__c , ownerid=u.id, Solicitar_PP__c = true,Solicitar_Malote__c = true, Solicitar_Dep_sito__c = true);
    insert t4;
    
    c003.Tipo_de_solicita_o__c  = 'Cache'; c003.tipo_de_pagamento__c = 'TURMAS'; c003.motivo__c = 'Solicitação de Pagamento'; c003.Forma_de_pagamento__c = 'DEPÓSITO + MALOTE'; c003.status = 'Novo'; c003.Quantas_PP_s_pagamento__c = 5; c003.Quantidade_de_PP_s_Estojo__c = 5;
    update t4;
    
    Task t14 = new Task(description=c003.tipo_de_pagamento__c,Status='Nenhum', Priority='Normal', whatId=c003.id, subject='Solicitação de Pagamento - Não aprovada', Solicita_o_de_Pagamento__c=c003.Tipo_de_solicita_o__c , ownerid=u.id, Solicitar_PP__c = true,Solicitar_Malote__c = true, Solicitar_Dep_sito__c = true);
    insert t14;
    
    Case c2 = new Case(tipo_de_pagamento__c = 'DESPESAS', motivo__c = 'Solicitação de Pagamento', Forma_de_pagamento__c = 'DEPÓSITO + MALOTE', status = 'Novo', Nota_fiscal__c = 'SIM', Tipo_de_solicita_o__c  = 'Produtos');
     insert c2;

    Task z1  = new Task(Status='Nenhum', Priority='Normal', subject = 'Solicitação de Pagamento - Solicitar Nota Fiscal', whatid=c2.id, Solicita_o_de_Pagamento__c=c2.Forma_de_pagamento__c, ownerid='005U0000002KGRq');
     insert z1;
     
    c2.Nota_fiscal__c = 'NÃO';
    delete z1;
     
     Task z2  = new Task(Status='Nenhum', Priority='Normal', subject = 'Solicitação de Pagamento - Nota recebida', whatid=c2.id, Solicita_o_de_Pagamento__c=c2.Forma_de_pagamento__c, ownerid='005U0000002KGRq');
     insert z2;
     
    c2.Nota_fiscal__c = 'NÃO';
    delete z2;
    
     Task z3  = new Task(Status='Nenhum', Priority='Normal', subject = 'Solicitação de Pagamento - Efetuar Pagamento', whatid=c2.id, Solicita_o_de_Pagamento__c=c2.Forma_de_pagamento__c, ownerid='005U0000002KGRq');
     insert z3;
     
     c2.Nota_fiscal__c = 'NÃO';
    delete z3;
}
}

 Thanks again !

Abhi_TripathiAbhi_Tripathi

Hey Everton,

 

Mark that answer as correct with KUDOS , for help of others.

 

And to increase your code coverage, go to eclipse or console check which line is not covered than try to cover in the test class 

 

surely it will increase

This was selected as the best answer