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
mansimansi 

Test class urgent help!!

Hi can any one tell me how to cover the below code in the test class..

Class name is SaveOnEditAmexCampaignCtrlrExt 

only first few lines of my below code are covered.. please tellme  how to cover the whole method

 

IspitaIspita

Hi Mansi,

Do share the test method written by you so far... that will help pinpoint the issue...

mansimansi

 here is the test method:

 

Navatar_DbSupNavatar_DbSup

Hi,

 

First of all you will create the list of all of your wrapper classes first like this

               

                list<accountWrapperList> accwrp=new list<accountWrapperList>();
                similarly for others;

                wrap.checkboxField=True;
                wrap.SE='85991';
                wrap.addressline1='A-3/8';
                wrap.city='AFTON';
                wrap.Name='Test';
                wrap.Country='United States of America';
                wrap.State='Alabama';
                wrap.language='US English';
                wrap.category='Dining';
                wrap.subcategory='American';
                wrap.addVerificationStatus = True;
               

                 Now write this accwrp.add(wrap);
                 similarly for others.

 

                Fianly call that method with the instance of your class like this;

                sc.fetchOffersForTheSelecetdMerchants();

 

                Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.

mansimansi

Hi the coverage has still not increased.. infact it decreased  from 76% to 75%. please find my test class below

 

static testmethod void SaveOnEditAmexCampaignCtrlrExtTest(){
         

Navatar_DbSupNavatar_DbSup

Hi,

 

There are some changes in above code:

 

Replace this mercwrap.Merchant='hello merchant';

With mercwrap.Merchant='test998';

 

Let me know if there any issue