function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
@isTest public class TriggerTestClass { static testMethod void testMethod1() { Task__c task = new Task__c(); task.Project_Apprroval__c = 'Approved'; task.Status__c = 'Open'; // Add all required field here. // task.task_executioner_1__C = insert task; } }
task.Project_Apprroval__c = 'Approved';
task.Status__c = 'Open';
in your test class code.
Thanks
Shashikant
http://amitsalesforce.blogspot.in/2015/06/best-practice-for-test-classes-sample.html
Please try below code i hope that will help u Please let us know if this will help you
Thanks
Amit Chaudhary
Thanks for your reply !!
Please find the test class code --
I am finding difficulties in traversing into nested if's like ----- if() { if(){} }
@isTest(seeAllData = True)
public class IPMO_Taskflagupdatetest{
static testMethod void generate3(){
String strRecordTypeId = [Select Id From RecordType Where SobjectType = 'Project__c' and Name = 'AXA BSG'].Id;
User strUserId = [SELECT Id FROM User where Name = 'Nishikanth Nandiraju'];
Contact strContactId = [SELECT Id FROM Contact where Name = 'Nishikanth Nandiraju'];
Project__c proj = new Project__c();
Integer i;
proj.Name = 'Test Project';
proj.Department_Name__c = 'AXA BSG';
proj.RecordTypeId = strRecordTypeId ;
proj.Project_Manager__c = strUserId.id ;
proj.AXA_BS_Project_Sponsor__c = strUserId.id ;
proj.Start_Date__c = System.today();
proj.End_Date__c = System.today()+10;
proj.Number__c =[select count() from Project__c where RecordTypeId =: strRecordTypeId ];
proj.Status__c = 'Approved';
insert proj;
Task__c tsk = new Task__c();
tsk.Name = 'test';
tsk.Start_Date__c = system.today()+2;
tsk.Due_Date__c= system.today()+5;
tsk.Status__c = 'Open';
tsk.Project__c = proj.id;
tsk.Project_Status_Approved__c = true;
tsk.Email_Sent_Flag__c = true;
insert tsk;
System.assert(tsk.Id != null);
tsk.Task_Executioner__c = strContactId.id;
tsk.Task_Executioner_1__c = strContactId.id;
tsk.Task_Executioner_2__c = strContactId.id;
update tsk;
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage ();
mail.setTargetObjectId(tsk.Task_Executioner__c);
}
}
Thanks !!