You need to sign in to do that
Don't have an account?
Benjamin Schlund
Short Apex Test
Hi, we're a non profit org with very limited recources. Therfore thanks for any help since we don't have IT personal.
I wrote this follwing Apex-Code which apparentely needs testing before deployment. I guess it's not to hard, but I have no idea how to do it. Thanks!
public class PV_Stundenerfassung {
public Contact getContact() {
return [select id, name, PV_Soz_Abgeleistete_Stunden__c,
(select name, PV_SE_Mitarbeiter__c, PV_SE_Datum__c, PV_SE_Stundenanzahl__c, LastModifiedBy.firstname, LastModifiedBy.lastname, LastModifiedDate, PV_SE_Datum_Anzeige__c, PV_SE_Zuletzt_geaendert_Anzeige__c
from Stundenerfassung__r )
from Contact where id =
:System.currentPageReference()
.getParameters().get('id')];
}
}
I wrote this follwing Apex-Code which apparentely needs testing before deployment. I guess it's not to hard, but I have no idea how to do it. Thanks!
public class PV_Stundenerfassung {
public Contact getContact() {
return [select id, name, PV_Soz_Abgeleistete_Stunden__c,
(select name, PV_SE_Mitarbeiter__c, PV_SE_Datum__c, PV_SE_Stundenanzahl__c, LastModifiedBy.firstname, LastModifiedBy.lastname, LastModifiedDate, PV_SE_Datum_Anzeige__c, PV_SE_Zuletzt_geaendert_Anzeige__c
from Stundenerfassung__r )
from Contact where id =
:System.currentPageReference()
.getParameters().get('id')];
}
}
Please check once above and add remain fields in contact and Stundenerfassung__c check once.
Hope this helps you.
All Answers
Above code is related to the visualforce page to test above code open VF page and pass id in the URL after page name
?id='contactrecordid'
Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.
Thanks
Varaprasad
@For Support: varaprasad4sfdc@gmail.com
thanks for your quick answer. The VF page is working and shows the right data. But I don't have any code coverage for deploying to production. For this I thought you have to write some kind of test class, but since there is no if-statement or anything, I don't know what to test for. Also I have no IT background. If you could help me out with the code, I'd be very grateful.
Please check once above and add remain fields in contact and Stundenerfassung__c check once.
Hope this helps you.
ac.name = 'testst'; // Here add remaining fields
Insert ac;