You need to sign in to do that
Don't have an account?
Admin User 8209
code coverage 0 %
my controller class
public class AbSearchInVFController {
public list <AddressBook__c> address {get;set;}
public String searchKey {get;set;}
public String blockKey {get;set;}
public String areaKey {get;set;}
public String buildingKey {get;set;}
public Address add {get; set;}
public Integer counter {get; set;}
public AbSearchInVFController( ) {
}
public void search(){
string searchquery=' select Name,Concerned_Person_Name__c,Company_Name__c ,Building_Name__c ,Location__c, Area_Occupied__c,'+
'Block__c,Floor__c,Plot_Area__c,City__c,Unit_No__c,Concerned_Person_mobile__c,Remarks_By_Support_Staff__c,Remarks_By_Surveyor__c, State__c ,Createddate,CreatedById, OwnerId,lastModifiedById'+
'from AddressBook__c'+
'where Location__c like \'%'+searchkey+'%\''+
'and Plot_Area__c like \'%'+areaKey+'%\''+
'and Building_Name__c like \'%'+buildingKey+'%\''+
'and block__c like \'%'+blockKey+'%\' Limit 100';
address=Database.query(searchquery);
}
public void clear(){
address.clear();
}
}
Test class.
@istest
public class AbSearchInVFControllerlTest{
public static TestMethod void Test(){
{
Test.startTest();
AddressBook__c testaddress = new AddressBook__c ();
testaddress.Unit_No__c ='1';
testaddress.Block__c ='A';
testaddress.Concerned_Person_mobile__c ='9910008084';
testaddress.Concerned_Person_Name__c ='mohan';
testaddress.Floor__c ='1';
testaddress.Building_Name__c ='buniyadt';
testaddress.Company_Name__c ='bun';
testaddress.State__c='up';
testaddress.Location__c='18 sector';
testaddress.Area_Occupied__c='1000';
testaddress.City__c='Noida';
testaddress.Remarks_By_Support_Staff__c='Test';
testaddress.Remarks_By_Surveyor__c='Test';
insert testaddress;
ApexPages.StandardController controller = new ApexPages.StandardController(testaddress);
Test.stopTest() ;
}
}
}
when i am deploing getting 0 % coverage
public class AbSearchInVFController {
public list <AddressBook__c> address {get;set;}
public String searchKey {get;set;}
public String blockKey {get;set;}
public String areaKey {get;set;}
public String buildingKey {get;set;}
public Address add {get; set;}
public Integer counter {get; set;}
public AbSearchInVFController( ) {
}
public void search(){
string searchquery=' select Name,Concerned_Person_Name__c,Company_Name__c ,Building_Name__c ,Location__c, Area_Occupied__c,'+
'Block__c,Floor__c,Plot_Area__c,City__c,Unit_No__c,Concerned_Person_mobile__c,Remarks_By_Support_Staff__c,Remarks_By_Surveyor__c, State__c ,Createddate,CreatedById, OwnerId,lastModifiedById'+
'from AddressBook__c'+
'where Location__c like \'%'+searchkey+'%\''+
'and Plot_Area__c like \'%'+areaKey+'%\''+
'and Building_Name__c like \'%'+buildingKey+'%\''+
'and block__c like \'%'+blockKey+'%\' Limit 100';
address=Database.query(searchquery);
}
public void clear(){
address.clear();
}
}
Test class.
@istest
public class AbSearchInVFControllerlTest{
public static TestMethod void Test(){
{
Test.startTest();
AddressBook__c testaddress = new AddressBook__c ();
testaddress.Unit_No__c ='1';
testaddress.Block__c ='A';
testaddress.Concerned_Person_mobile__c ='9910008084';
testaddress.Concerned_Person_Name__c ='mohan';
testaddress.Floor__c ='1';
testaddress.Building_Name__c ='buniyadt';
testaddress.Company_Name__c ='bun';
testaddress.State__c='up';
testaddress.Location__c='18 sector';
testaddress.Area_Occupied__c='1000';
testaddress.City__c='Noida';
testaddress.Remarks_By_Support_Staff__c='Test';
testaddress.Remarks_By_Surveyor__c='Test';
insert testaddress;
ApexPages.StandardController controller = new ApexPages.StandardController(testaddress);
Test.stopTest() ;
}
}
}
when i am deploing getting 0 % coverage
Hi,
Please find the solution.
Please do some needful changes according to your code.
Please mark it as the Best Answer if it helps you.
Thank You