You need to sign in to do that
Don't have an account?
Praneeth Yanamadala
Need Clarification on @isTest usage while creating a TestUtility class.
Why shouldn't we write @isTest before the class, for the RandomContactFactory trialhead challenge? The Example shown in the same trialhead for the class 'TestDataFactory' has @isTest before the class.
Check below reference for @isTest usage.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_isTest.htm
If you have any issues with trailhead challenges reach out to trailhead support team using below link.
Support:https://trailhead.salesforce.com/help
Hope above information was helpful.
Please mark as Best Answer so that it can help others in the future.
Thanks,
TestFactory type class is a best prctices according to salesforce. this is very usefull when we want to create same record on different-2 classes like Account record is creating 100 apex classes now for test coverage we need to create account in eact test class, but instead of each test class we can create a globel TestFactory class that's will have all comman type methods like Account , Contact, opportuity creaton or updation operat
if we use @isTest then this class will work for test, means by this classs we can't create actual records and can't send email.
@isTest methos class code does not include total ORG character limit
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh
Can you please give me the Trailhead url, i will check my side
Regards
Mukesh
We use @isTest annotation before Classes and methods in Test Class.
This is sample code. Go through these links for detail explanation.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_isTest.htm
https://trailhead.salesforce.com/en/content/learn/modules/apex_testing/apex_testing_data
If you find your Solution then mark this as the best answer.
Thank you!
Regards
Suraj Tripathi
i can invistigate this issue if you share details, and willl try to provide better solution
Regards
Mueksh