• pirouz sourati 10
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
hi guys im really new to apex and salesforce i need to write a test class for this class
public without sharing class CM_Report_LTN_Controller {
    public String reportId {get;set;}
    public String reportIdStato {get;set;}
    public User userReport {get;set;}
    public String dashId {get;set;}
    public String URL {get;set;} 

    public CM_Report_LTN_Controller(ApexPages.StandardController controller) {
        dashId = [SELECT DeveloperName,Id,Name FROM Report WHERE 
                            DeveloperName = 'POD_Report'
                            LIMIT 1].Id;
        system.debug('CM_Report_LTN_Controller reportId is'+dashId);
            
        // Get the report metadata
        Reports.ReportDescribeResult describeDash = Reports.ReportManager.describeReport(dashId);
        Reports.ReportMetadata DashMd = describeDash.getReportMetadata();
        Reports.ReportResults resultsDash = Reports.ReportManager.runReport(dashId, DashMd);
        
        reportId = [SELECT DeveloperName,Id,Name FROM Report WHERE 
                            DeveloperName = 'Codice_Fiscale_Report'
                            LIMIT 1].Id;
        system.debug('CM_Report_LTN_Controller reportId is'+reportId);
            
        // Get the report metadata
        Reports.ReportDescribeResult describe = Reports.ReportManager.describeReport(reportId);
        Reports.ReportMetadata reportMd = describe.getReportMetadata();
        Reports.ReportResults results = Reports.ReportManager.runReport(reportId, reportMd);
        
        URL__C u = URL__C.getInstance();
        URL = u.urlOrg__c;
        
        }  
    
}
so far i worte this which is not correct at all 
@isTest
public class CM_Report_LTN_ControllerTest {
	@isTest
    static void test(){
        Report rp = new Report();
        ApexPages.StandardController cont = new ApexPages.StandardController(rp);
        CM_Report_LTN_Controller controller = new CM_Report_LTN_Controller(cont);
    }
}

is there anyone that can help me with this ? or give me some info about ApexPages.StandardController ?
 
hi guys im really new to apex and salesforce i need to write a test class for this class
public without sharing class CM_Report_LTN_Controller {
    public String reportId {get;set;}
    public String reportIdStato {get;set;}
    public User userReport {get;set;}
    public String dashId {get;set;}
    public String URL {get;set;} 

    public CM_Report_LTN_Controller(ApexPages.StandardController controller) {
        dashId = [SELECT DeveloperName,Id,Name FROM Report WHERE 
                            DeveloperName = 'POD_Report'
                            LIMIT 1].Id;
        system.debug('CM_Report_LTN_Controller reportId is'+dashId);
            
        // Get the report metadata
        Reports.ReportDescribeResult describeDash = Reports.ReportManager.describeReport(dashId);
        Reports.ReportMetadata DashMd = describeDash.getReportMetadata();
        Reports.ReportResults resultsDash = Reports.ReportManager.runReport(dashId, DashMd);
        
        reportId = [SELECT DeveloperName,Id,Name FROM Report WHERE 
                            DeveloperName = 'Codice_Fiscale_Report'
                            LIMIT 1].Id;
        system.debug('CM_Report_LTN_Controller reportId is'+reportId);
            
        // Get the report metadata
        Reports.ReportDescribeResult describe = Reports.ReportManager.describeReport(reportId);
        Reports.ReportMetadata reportMd = describe.getReportMetadata();
        Reports.ReportResults results = Reports.ReportManager.runReport(reportId, reportMd);
        
        URL__C u = URL__C.getInstance();
        URL = u.urlOrg__c;
        
        }  
    
}
so far i worte this which is not correct at all 
@isTest
public class CM_Report_LTN_ControllerTest {
	@isTest
    static void test(){
        Report rp = new Report();
        ApexPages.StandardController cont = new ApexPages.StandardController(rp);
        CM_Report_LTN_Controller controller = new CM_Report_LTN_Controller(cont);
    }
}

is there anyone that can help me with this ? or give me some info about ApexPages.StandardController ?