You need to sign in to do that
Don't have an account?
beenish khan 1
How to increae Code Coverage
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
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(); } }
Can you tell me which lines are not covered, so that I can help you out if possible.
Regards
Prad