• Bahri Yucesan
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1
    Replies
Hi all ,
We need write log somewhere  when a user get an export of report. Is there any way , or any tool free or paid.
Please help me 

Kind Regards
Hi all , We have a serious problem about our Apex Classes.  Approximately 5 days ago our all Apex Codes and all Apex Triggers start  getting  " 0% Code Coverage " error. Before that everythings are ok. But when we trying create new very basic Apex Class   , then getting always same problem. We are deleted all  Apex Classes and Apex Triggers but still getting same error. The Sample Code and Test Code  as  follows , How can we fix that coverage  problem.


------------------------------
public class GunlukRaporlar {

 static void Yap()
    {
        List<Account> allAcc = [select Id,Name from Account limit 5];
        
        for(Account acc:allAcc)
        {
            String cc = acc.Industry;
        }
        
        String aa = 'bb';
    }
}
------------------------------
---------- TEST -----------
@isTest
public with sharing class GunlukRaporlarTest {
    
    static testMethod void testYap()
    {
        List<Account> accList = new List<Account>();
        
        Account a = new Account();
        a.Name='TESTACCOUNT';
        a.Industry = 'Banka';
        insert a;
        
        accList.add(a);
        
        System.assertEquals(accList[0].Industry, 'Banka');  
    }
}

-----------------------------
Thanks for all 
King Regards.
  
Hi all, 
I build a Class and its Unit Test Class as follows but Code Coverage %38. How can i pass %75.

Class 
public class AccountTrainerRelaionController {
    
    public Boolean Show { get; set; }
    public List<Attendees__c> trainerList   { get; set; }
    private ApexPages.StandardController std;
    public Class__c a {get; set;}
    public List<TrainerClass> TrainerClassList {get; set;}
    
public AccountTrainerRelaionController(ApexPages.StandardController controller) {
    std = controller;
}

public PageReference Search() {
        Show=true;  
        a = (Class__c) std.getRecord();
        
        String TrainerCheck ='name';
        
        
        List<Attendees__c> results = [select Class__r.Trainer__r.Name , Class__r.Trainer__r.Id , Class__r.Instruction__r.Name , Class__r.AttendeeCount__c , Class__r.Id , Class__r.Name, 
                                      Class__r.Baslangic_Tarihi__c , Name , Id , Contact__r.Name ,
                                      Contact__r.Id , Contact__r.Title , Contact__r.Email 
                                      from Attendees__c where Contact__r.Account.Id =:a.Account__c and Class__r.Trainer__c !=null order by Class__r.Trainer__r.Name,Class__r.Id ];
        
        List<ClassClass> cclist = new List<ClassClass>();
        
        TrainerClassList =  new   List<TrainerClass>(); 
        //TrainerClass tc = new TrainerClass(); 
        List<Attendees__c> attList = new List<Attendees__c>();
        ClassClass cc = new ClassClass();
        
        List<TrainerClass> tcList = new List<TrainerClass>();
        TrainerClass tc = new TrainerClass();
        for(Attendees__c c : results) 
        {      
                 if (TrainerCheck != c.Class__r.Trainer__r.Name )
               { 
                 tc = new TrainerClass();
                 tc.TrainerName = c.Class__r.Trainer__r.Name;
                 tc.TrainerId   = c.Class__r.Trainer__r.Id;
                 tcList.add(tc);
                 
                 TrainerClassList.add(tc);
                 TrainerCheck = c.Class__r.Trainer__r.Name;
               }
        }
        
        
        List<ClassClass> clList = new List<ClassClass>();
        ClassClass cl = new ClassClass();
        
        List<Attendees__c> atdList = new List<Attendees__c>();
        Attendees__c atd = new Attendees__c();
        for(TrainerClass t : TrainerClassList) 
        {      
             for(Attendees__c c : results) 
             {   
                if (t.TrainerId  == c.Class__r.Trainer__r.Id )
                {  
                cl = new ClassClass();
                cl.ClassName = c.Class__r.Name;
                cl.ClassId = c.Class__r.Id;
                cl.CourseName = c.Class__r.Instruction__r.Name;
                cl.AttendeeCount = c.Class__r.AttendeeCount__c;
                cl.BaslangicTarihi = c.Class__r.Baslangic_Tarihi__c;
                clList.add(cl);
                
                }
                else
                {
                t.Classes = clList;
                }
            }  
            clList = new List<ClassClass>();
       
            for(ClassClass c : t.Classes)
            {
                atdList = new List<Attendees__c>();
                 for(Attendees__c a : results) 
                {
                   if( c.ClassId == a.Class__r.Id )
                    {atdList.add(a);}
                   
                }
                c.Attendees = atdList;
            }
           
         }  
        
        
        return null;
} 






public class TrainerClass{
   public String TrainerName{get; set;}
   public String TrainerId{get; set;}
   public List<ClassClass> Classes{get; set;}
}

public class ClassClass{
   public String ClassName{get; set;}
   public String ClassId{get; set;}
   public String CourseName{get; set;}
   public Decimal AttendeeCount{get; set;}
   public Date BaslangicTarihi{get; set;}
   public Integer ClassCount{get; set;}
   public List<Attendees__c> Attendees{get; set;}
}



}

My Test Units  
 
@isTest
public class AccountTrainerRelaionControllerTest {


  static testMethod void testSearch() {
  
   Courses__c course = new Courses__c();
   course.Name='TESTCOURSE';
   insert course;
   
   Trainer__c tc = new Trainer__c();
   tc.Egitmen_Adi__c= 'test';
   tc.Egitmen_Soyadi__c = 'deneme';
   insert tc;
   
    Class__c cl = new Class__c();
    cl.Instruction__c = course.Id;
    cl.Baslangic_Tarihi__c = System.today();
    cl.Bitis_Tarihi__c = System.today();
    cl.Egitim_Suresi__c = 1;
   insert cl;
    
    ApexPages.StandardController controller = new ApexPages.StandardController(cl);
    AccountTrainerRelaionController cont = new AccountTrainerRelaionController(controller);
    cont.a=cl;
    cont.Search();
    //call method
    //PageReference pageReference = cont.Search();
    
    System.assertEquals(0,cont.TrainerClassList.size());
    
    //get url
    String url = '/apex/AccountTrainerRelation';
    
    //is not equal
    System.AssertEquals(url ,pageReference.getUrl());
  }
}
Thanks
 
Hi all , We have a serious problem about our Apex Classes.  Approximately 5 days ago our all Apex Codes and all Apex Triggers start  getting  " 0% Code Coverage " error. Before that everythings are ok. But when we trying create new very basic Apex Class   , then getting always same problem. We are deleted all  Apex Classes and Apex Triggers but still getting same error. The Sample Code and Test Code  as  follows , How can we fix that coverage  problem.


------------------------------
public class GunlukRaporlar {

 static void Yap()
    {
        List<Account> allAcc = [select Id,Name from Account limit 5];
        
        for(Account acc:allAcc)
        {
            String cc = acc.Industry;
        }
        
        String aa = 'bb';
    }
}
------------------------------
---------- TEST -----------
@isTest
public with sharing class GunlukRaporlarTest {
    
    static testMethod void testYap()
    {
        List<Account> accList = new List<Account>();
        
        Account a = new Account();
        a.Name='TESTACCOUNT';
        a.Industry = 'Banka';
        insert a;
        
        accList.add(a);
        
        System.assertEquals(accList[0].Industry, 'Banka');  
    }
}

-----------------------------
Thanks for all 
King Regards.