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
Pat WimsattPat Wimsatt 

test page reference

I would swear my test was working before but now it's not and I can't figure out why.  Thoughts?  Here's my test... pretty simple. 

This process works in my Sandbox, it just want test properly when I try to push it to prod. 


@isTest
public class RetrieveLaneDetailTest {
     
    @isTest public static void lanerates() {
        LaneDetailCon laneDetail = new LaneDetailCon();
        PageReference page = laneDetail.executeSearch();
        System.assert(true);
    }
}

Here's my controller:  
public with sharing class LaneDetailCon {
    
    public String oCity { get; set; }
    public String dCity { get; set; }
    public String rType { get; set; }
    public Boolean searched {get; set;}
    
    public List<Lane_Detail__C> lanes { get; set; }
        
public LaneDetailCon(){ 
    searched=false;    
        String orCity = ApexPages.currentPage().getParameters().get('oCity');
        String dsCity = ApexPages.currentPage().getParameters().get('dCity'); 
        String recType = ApexPages.currentPage().getParameters().get('rType');   
        if (null!=orCity)
        {
            oCity = orCity;
            dCity = dsCity;
            rType = recType;
            executeSearch();
        }
    }
    
public PageReference executeSearch(){
    searched=true;
        
           lanes =  [SELECT id, Origin_City__c, Origin_Statess__c, Destination_City__c, Destination_States__c, Rate__c, 
                             RecordTypeId, Rate_10K__c, Rate_30K__c, CPBD_10K__c, CPBD_30K__c,
                             Opportunity__r.Name, Opportunity__r.AccountId, Opportunity__r.Date_Quoted__c, Opportunity__r.StageName 
                     FROM Lane_Detail__c
                     WHERE Origin_City__c = :oCity AND Destination_City__c = :dCity AND RecordTypeId = :rType
                     Order By Opportunity__r.Date_Closed__c Desc
                     LIMIT 25]; 

        return null;
    }
}
 
ShirishaShirisha (Salesforce Developers) 
Hi Pat,

Greetings!

It could be because of the data which might be varied.So,I would suggest you to capture the debug logs while running the test class to see,which is causing the issue.

Reference:https://help.salesforce.com/apex/HTViewHelpDoc?id=code_add_users_debug_log.htm&language=en_us

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri