Skip to main content
I am able to save the code, when i run the test class,it gives the error - 0/1 test methods passed

Please help..

Controller class

--------------------

public without sharing class ClsCustomController{

    public List<myCustomObject__c> mylist{get; set;}

    public myCustomObject__c myObject{get;set;}

    public Id myId{get;set;}

        

    public ClsCustomController(){

        myId = ApexPages.currentPage().getParameters().get('id');

        mylist = [select ID,Link__c,Product__c,Hierarchy_Name__c ,Item_Position__c,Primary_Product_Group__c ,

                          Probability__c ,Quantity__c ,

                          NetPrice__c,LineStatus__c ,

                          Validated__c,Line_Item_Id__c   from myCustomObject__c where  

                          Proposal__c =: myId];

        

        

    }

    public ClsCustomController(ApexPages.StandardController controller){

        qte = (myCustomObject__c)controller.getRecord();

        mylist = [select ID,Link__c,Product__c,Hierarchy_Name__c ,Item_Position__c,Primary_Product_Group__c ,

                          Probability__c ,Quantity__c ,

                          NetPrice__c,LineStatus__c ,

                          Validated__c,Line_Item_Id__c   from myCustomObject__c where  

                          Proposal__c =: myId];

        

       

    }

}

---------------------------------------------------------------------------------------

test class 

----------------

@isTest(SeeAllData=true)

public class ClsCustomController {

static testMethod void ClsCustomController() {

myCustomObject__c myObject = new myCustomObject__c();

    myObject.id = propSO.id;

    myObject.Hierarchy_Name__c = 'Indoor SF6-Insulated Load Break Switch GSec';

    myObject.Item_Position__c ='1';

    myObject.Primary_Product_Group__c = true;

    myObject.Probability__c =Decimal.valueOf(30);

    myObject.Quantity2__c =Decimal.valueOf(30);

    myObject.NetPrice__c =Decimal.valueOf(1000);

    myObject.LineStatus__c = 'Open';

    myObject.Validated__c = true;

    myObject.DerivedFromId__c = 'a2X25000004rSPuEAM';

    insert proposalLineItem;

   

    

Test.startTest();

    

PageReference pageRef = Page.VFCustomController;

Test.setCurrentPage(pageRef);

pageRef.getParameters().put('id',myObject.id);   

ApexPages.StandardController sc = new ApexPages.StandardController(myObject);    

ClsCustomController myClass = new ClsCustomController(sc);

ClsCustomController myClass1 = new ClsCustomController();

Test.stopTest();

        }

}
7 answers
  1. Mar 12, 2018, 9:52 AM
    Can you please post your full test class which you are using as i can see below code but object of propSO is not there in your test class

    propSO.id
0/9000