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
Rick MacGuiganRick MacGuigan 

Unit Test - unable to access page in

I have a unit test that is running successfully however I cannot open the results in the developer console. Getting an error: Failed
to load data Log from Salesforce.com: Other unit test do open up in the devveloper console so I'm not sure why these recent test do not.. Any ideas on what could be casuing this ? 

User-added image

Unit test:
@isTest
private class UnitTest_Driver {
  
  //Test coverage for New Driver Creation (VF page) 
  static testmethod void testNewDriver() {

      
    Account acct = UtilityAudit.getAccount();
    insert acct;
    Audit__c audit = UtilityAudit.getAudit(acct.Id);
    insert audit; 
    Auto_Audit_Sample_Policy__c sample = UtilityAudit.getAuto_Audit_Sample_Policy(audit.Id);
    insert sample;
     Auto_Drivers__c driver = UtilityAudit.getAuto_Drivers(sample.Id);
     //driver.Driver_Birth_Year__c = '9999';
    insert driver;

    //initiate the VF page
    PageReference pageRef = Page.PROD_Audit_Auto_DriverSample_New;
    Test.setcurrentPage(pageref);
       //these parms are passed via custom button ?accId={!Audit__c.Id}&sampleId={!Auto_Audit_Sample_Policy__c.Id}
    Apexpages.currentPage().getParameters().put('AccId', audit.Id);
    Apexpages.currentPage().getParameters().put('sampleId', sample.Id);
 
    //create standard controller and extended controller instance
    ApexPages.StandardController sc = new ApexPages.standardController(driver);
    ParentChildExtensionDRIVERsample_New testDriverPage = new ParentChildExtensionDRIVERsample_New(sc);


    //save the controller to get the URL
    String testPage = sc.save().getUrl();
    System.debug('TestPage result:' + testPage);

    // Verify that page fails without parameters
    // System.assertEquals('/apex/failure?error=noParam', testPage);



    //TODO
    String accID=ApexPages.currentPage().getParameters().get('AccId');
    System.debug('accID: ' + accID);
    String sampleID=ApexPages.currentPage().getParameters().get('sampleId');
    System.debug('sampleID: ' + sampleID);
    
    List< Audit__c> drivers = [ select Id, Driver_Information__c, Age__c, Gender__c, Marital_Status__c, Named_Insured_Add_Driver__c, Occupation__c, Business_Use__c, MVR_Violations__c, Credit_Scoring__c                
         from Audit__c 
         where Id = :ApexPages.currentPage().getParameters().get('accId')]; 
    System.debug('Age : ' + drivers[0].Age__c );
    
  } 
}

 
Best Answer chosen by Rick MacGuigan
EnreecoEnreeco
Hi Rick,
ha you tried deleting all test data form the org and ran the test again?
To delete test data go to Setup > Deveoper > Apex Test Execution > View Test History (link) > Clear Test Data (Button).

Sometimes it happens that test data is badly written (I don't know why) and you need a "reset" of your test data.

Hope this could help.
--
May the FOrce.com be with you!

All Answers

EnreecoEnreeco
Hi Rick,
ha you tried deleting all test data form the org and ran the test again?
To delete test data go to Setup > Deveoper > Apex Test Execution > View Test History (link) > Clear Test Data (Button).

Sometimes it happens that test data is badly written (I don't know why) and you need a "reset" of your test data.

Hope this could help.
--
May the FOrce.com be with you!
This was selected as the best answer
Rick MacGuiganRick MacGuigan
Thanks Enreeco, that worked ! Our network was implementing a 3rd party single sign on product . Required us to use a custom domain name as well. It's possible that things got hosed up a bit while I was running some test during this time. 
EnreecoEnreeco
Sometimes test execution makes me crazy as well :)