function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Prince VenkatPrince Venkat 

Test class for parameters

How to add parameterized method in testclass.
My sample class
public class Training{
public static void work (Account accRec){
----------
-------
}

how to write test class for this

@isTest
private class testClass
{
testmethod static void myTest ()
{
test.starttest();
Training.work ();
test.stoptest();
}
}

getting error

Any Assistance



 
Best Answer chosen by Prince Venkat
CharuDuttCharuDutt
Hii Prince 
Try Below Test Class
@isTest
private class testClass
{
@isTest
public static void myTest ()
{
Account Acc = new Account();
Acc.name='test';
insert Acc;

test.starttest();
Training.work (Acc);
test.stoptest();
}
}
Please Mark It As Best Answer If It Helps
Thank You!