You need to sign in to do that
Don't have an account?
Riyaj
How to write Test class
Hi Guys,
Can any body tell me how to write the test class for the below class.
global class getAttendance{
WebService static Attendance__c getAttendanceFromClassname(string classname){
List<Attendance__c> r =[SELECT id,attendance_Date__c,attendance_Roll__c,class_name__c,Remarks__c,student_Name__c FROM Attendance__c WHERE class_name__c = :classname];
Attendance__c r1;
if(r.size()>0)
{
r1=new Attendance__c(student_Name__c=r[0].student_Name__c,attendance_Roll__c=r[0].attendance_Roll__c,id=r[0].id,Remarks__c=r[0].Remarks__c);
return r[0];
}
else
return new Attendance__c();
}
}
Hi
@isTest
Public class getAttendance_test{
public static testmethod void getAttendance_test(){
Attendance__c att = new Attendance__c()
att.
.here insert the fields in query for att and also for mandotory fields
..
.
insert att;
}}
Regards,
Rajesh S.