You need to sign in to do that
Don't have an account?

i am getting the message - 0/1 test methods passed
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();
}
}
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();
}
}
I removed SeeAllData=true and removed the hardcoded line as you had suggested, but still facing the same error
code coverage from running this test class was not applied due to a conflicting
0/1 test method passed
1) https://salesforce.stackexchange.com/questions/147262/code-coverage-from-running-this-test-class-was-not-applied-due-to-a-conflicting
Let us know if this will help you
Maybe there is problem with the code.please suggest changes to the code
propSO.id