You need to sign in to do that
Don't have an account?
RichardR1
Please help with Test Class Code Coverage of Controller Extension
I am new to development and need help to pass test class code coverage for my controller extension. It is currently only at 63% coverage.
Controller Extension:
Controller Extension:
public class IVExtension { public String sortOrder = 'Parameter__c '; public Interview__c i { get; set; } public List<Interview_Questions__c> getq(){ List<Interview_Questions__c> results = Database.query( 'SELECT Id, Parameter__c , ECA_Rating__c, Response_Notes__c, Question__c ' + 'FROM Interview_Questions__c ' + 'ORDER BY Parameter__c ASC ' ); return results; } public ApexPages.StandardController sc; public IVExtension(ApexPages.StandardController sc) { i = (Interview__c)sc.getRecord(); } public PageReference saveRecord() { update i.Interview_Questions__r; return null; } }
Test Class:
@isTest public class testIVExtension{ testmethod static void testcondition0(){ test.startTest(); try{ Interview__c i = new Interview__c (Job_Applicant__c = 'a0D3a00000NxusC'); insert i; Interview_Questions__c q = new Interview_Questions__c(Interview_Parameter__c = 'a2Q3a000001QPcI',Interview__c = i.id, ECA_Rating__c = '1',Response_Notes__c = 'test',Question__c = 'test'); insert q; ApexPages.StandardController sc = new ApexPages.standardController(i); IVExtension IE = new IVExtension(sc); IE.saveRecord(); } catch (Exception e) { system.assert(e!=null); } test.stopTest(); } testmethod static void testcondition1(){ test.startTest(); try{ List<Interview_Questions__c> results = Database.query( 'SELECT Id, Parameter__c , ECA_Rating__c, Response_Notes__c, Question__c ' + 'FROM Interview_Questions__c ' + 'ORDER BY Parameter__c ASC ' ); } catch (Exception e) { system.assert(e!=null); } test.stopTest(); } }You can probably tell by now that I only understand half of what I'm doing...
Anudeep (Salesforce Developers)
Can you please highlight the lines of the code that are not covered?