You need to sign in to do that
Don't have an account?
beenish khan 1
Test Class for project
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
Test Class
If any one can help me with the code i will appreciate it
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
-Thanks
Ashlekh Gera
Thanks for the reply it is covering only 64% of the code how can i get the 80 % code coverage