• beenish khan 1
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1
    Replies
I am writing a test class for the controller but it is covering only 64% of the code how i can increase the code coverage
Here is my Controller
public with sharing class propertycontrollerdetail {
public seit__Property__c ppo {get; set;}


    public propertycontrollerdetail(ApexPages.StandardController controller)
    {
       ppo = new seit__Property__c();
    }

    public pageReference SaveA()
    {
        try{
         upsert ppo;
        PageReference pageRef = new PageReference('https://itroos-dev-ed--seit.na34.visual.force.com/apex/Property');
        pageRef.setRedirect(true);
        return pageRef;  
        }
        catch(Exception ex)
        {
           ApexPages.addMessages(ex);
         system.debug(ex);
         PageReference pageRef = new PageReference('https://itroos-dev-ed.my.salesforce.com/a01/o');
        pageRef.setRedirect(true);

        throw ex;
        }
    }
}
and my test class is
@isTest
public class TestPropertyController{
  
    static testMethod void saveA(){

    Property__c pro = new Property__c( seit__Address__c = 'Lalazkhbhjkgar',seit__Description__c='sghj sjgh ',       seit__Size__c='10 Marla',seit__Size_in_sq_ft__c='12000',seit__Status__c='Sold',seit__Type__c='Residential');
insert pro;
         ApexPages.StandardController sc = new ApexPages.standardController(pro);
         Propertycontrollerdetail testAccPlan = new propertycontrollerdetail(sc);
         PageReference pageRef = Page.Property;
         pageRef.getParameters().put('id', String.valueOf(pro.Id));
         Test.setCurrentPage(pageRef);
         propertycontrollerdetail controller = new propertycontrollerdetail(sc);
         controller.SaveA();

    }
}


 
Hello Every one 
I am new to salesforce and apex and i am writing a test class for my controller but it is covering 0% of my code if any one can help me with the test class

Apex Controller/Class
public with sharing class propertycontrollerdetail {
public seit__Property__c ppo {get; set;}
  
    
    public propertycontrollerdetail(ApexPages.StandardController controller)
    {
       ppo = new seit__Property__c();
    }
    
    public pageReference SaveA()
    {
        try{
         upsert ppo;
        PageReference pageRef = new PageReference('https://itroos-dev-ed--seit.na34.visual.force.com/apex/Property');
        pageRef.setRedirect(true);
        return pageRef;  
        }
        catch(Exception ex)
        {
           ApexPages.addMessages(ex);
		 system.debug(ex);
		 PageReference pageRef = new PageReference('https://itroos-dev-ed.my.salesforce.com/a01/o');
        pageRef.setRedirect(true);
       
        throw ex;
        }
    }
}

Test Class
@isTest
public class TestPropertyController{
  
    static testMethod void saveA(){
    
        Property__c pro = new Property__c( seit__Address__c = 'Lalazkhbhjkgar',seit__Description__c='sghj sjgh ',seit__Size__c='10 Marla',seit__Size_in_sq_ft__c='12000',seit__Status__c='Sold',seit__Type__c='Residential');
        try
        {
        insert pro;
            System.debug('Insert Successfull');
        }
        catch(Exception ex)
        {
            System.debug(ex.getMessage());
        }
       
	ApexPages.StandardController sc = new ApexPages.standardController(pro);

	propertycontrollerdetail controller = new propertycontrollerdetail(sc);
        
    }
}

If any one can help me with the  code i will appreciate it
I am trying to add google map in modal pop up when the row is clicked and in the modal i am tryig to show google map
Google map is not showing when modal popup is first show but when i click on inspect element google map shows up and chrome is given error
TypeError: Sfdc.Dom is undefined
      VSMetadataSender</<.createAppDomainFrame()
 VFMetadataSender.js:62
.sendViewstate()
 VFMetadataSender.js:64
<anonymous>
Hello Every one 
I am new to salesforce and apex and i am writing a test class for my controller but it is covering 0% of my code if any one can help me with the test class

Apex Controller/Class
public with sharing class propertycontrollerdetail {
public seit__Property__c ppo {get; set;}
  
    
    public propertycontrollerdetail(ApexPages.StandardController controller)
    {
       ppo = new seit__Property__c();
    }
    
    public pageReference SaveA()
    {
        try{
         upsert ppo;
        PageReference pageRef = new PageReference('https://itroos-dev-ed--seit.na34.visual.force.com/apex/Property');
        pageRef.setRedirect(true);
        return pageRef;  
        }
        catch(Exception ex)
        {
           ApexPages.addMessages(ex);
		 system.debug(ex);
		 PageReference pageRef = new PageReference('https://itroos-dev-ed.my.salesforce.com/a01/o');
        pageRef.setRedirect(true);
       
        throw ex;
        }
    }
}

Test Class
@isTest
public class TestPropertyController{
  
    static testMethod void saveA(){
    
        Property__c pro = new Property__c( seit__Address__c = 'Lalazkhbhjkgar',seit__Description__c='sghj sjgh ',seit__Size__c='10 Marla',seit__Size_in_sq_ft__c='12000',seit__Status__c='Sold',seit__Type__c='Residential');
        try
        {
        insert pro;
            System.debug('Insert Successfull');
        }
        catch(Exception ex)
        {
            System.debug(ex.getMessage());
        }
       
	ApexPages.StandardController sc = new ApexPages.standardController(pro);

	propertycontrollerdetail controller = new propertycontrollerdetail(sc);
        
    }
}

If any one can help me with the  code i will appreciate it