0

I have one test class which is working fine in one sandbox but same test class is getting failed in other sandbox. Below method is not working in Sandbox which may be cause of error.

Error: pageReference = standardController.delete();


static testMethod void deleteCaseForOtherTest() {
    User u1 = CCC_TestCommonHelper.createUserForTurkey('Agent', Global_Constants.PROFILE_CC_AGENT);
    User u2 = CCC_TestCommonHelper.createUserForTurkey('Manag', Global_Constants.PROFILE_CC_MANAGER);
    Case c;
    List<Case> cases;

    System.runAs(u1) {
        c = new Case(
            RecordTypeId =  RecordTypeHelper.CASE_RECORD_TYPES.get('Complaints'),
            Status = 'Test_Status',
            Sub_Status__c = 'Test_Substatus',
            OwnerId = UserInfo.getUserId(),
            Description = 'Test_Description'
        );
        insert c;
    }
    System.runAs(u2) {
        // START Testing
        ApexPages.StandardController standardController = new ApexPages.StandardController(c);
        Global_CaseDeleteController testController = new Global_CaseDeleteController(standardController);
        testController.checkDelete();
        cases = [SELECT id FROM Case WHERE id = :c.id];
        System.assertEquals(0, cases.size());
        // END Testing
    }
}
3
  • Share the test class, please Jun 16 '15 at 11:58
  • Silly question, but are the sandboxes identical? Same release, same picklist values, same everything?
    – HomerJ
    Jun 16 '15 at 12:25
  • That wasn't his question. Your user profiles, record types and other configurations could be different between the two sandboxes causing your problem. Look at your above code, the objects it accesses and understand what it does! This is all based on record types, profiles and the content of other controllers which you say are the same. That points to what's different about the sandbox configs that would cause the problem?
    – crmprogdev
    Jun 16 '15 at 13:02
1

Problem was confliction between two orgs for OWD for the Objects(here Case). I did changes to OWD. Its working fine :) Thanks for help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.