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
JoVillJoVill 

How to create test method without DML

Hi All.

 

I need help from masters.

I created managed package with Apex classes VF pages .... Now I need to upload my package into Apexchange

but I can't because of what is required from 75 - 100% tests for Apex code.How to create test methods for Apex classes like this:

 

Public class AppProcList
{
    public PageReference ShowFullR() {
       PageReference pageRef = new PageReference('/grape/grape.apexp?Id=04aA0000000TNJl');
       pageRef.setRedirect(true);
    return pageRef;}
    
    public PageReference ShowShortR() {
       PageReference pageRef = new PageReference('/grape/grape.apexp?Id=04a800000000Bvt');
       pageRef.setRedirect(true);
    return pageRef;}

    public PageReference ShowFullP() {
       PageReference pageRef = new PageReference('/grape/grape.apexp?Id=04aA0000000TNMg');
       pageRef.setRedirect(true);
    return pageRef;}
    
    public PageReference ShowFullI() {
       PageReference pageRef = new PageReference('/grape/grape.apexp?Id=04a800000000C6g');
       pageRef.setRedirect(true);
    return pageRef;}
    
      public PageReference ShowFullRi() {
       PageReference pageRef = new PageReference('/grape/grape.apexp?Id=04a800000000C6l');
       pageRef.setRedirect(true);
    return pageRef;}
    
     public PageReference ShowFullRbv() {
       PageReference pageRef = new PageReference('/grape/grape.apexp?Id=04aA0000000TNMl');
       pageRef.setRedirect(true);
    return pageRef;}
    
 
}
Help please.This is very important and urgent. Thanx.
Anand@SAASAnand@SAAS
Check out how to create testing custom controllers here. Testing methods don't have to do DML all the time.