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
lescclarkcpdlescclarkcpd 

Can't get test coverage of this method!

Hi

 

i'm pretty new to dev & need a test script for tbelow, I have covered everything else but this!  

 

public id appId {get; set;}

public Cart_item__c doRemoveApp() {

        Cart_item__c doomedAccts = [

                select id, name 

                from Cart_item__c 

                where id = :AppID]; 

        try {   

     

                delete doomedAccts;

        } 

        catch (DmlException e) { 

                // Process exception here  

                }

        return Null;

        }

 

thanks

 

Vinit_KumarVinit_Kumar

Are you using it in a VF extension or a custom controller.Please paste the whole code so that we can help.

lescclarkcpdlescclarkcpd

Hi, appid is pulled from a VF page

 

global without sharing class CartController {

 

public id appId {get; set;} 

public Cart_item__c doRemoveApp() {

        Cart_item__c doomedAccts = [

                select id, name 

                from Cart_item__c 

                where id = :AppID]; 

        try {   

         

                delete doomedAccts;

        } 

        catch (DmlException e) { 

                // Process exception here  

                }

        return Null;

        }

}

 

thanks