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
Praneeth YanamadalaPraneeth 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.
VinayVinay (Salesforce Developers) 
Hi Praneeth,

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,
mukesh guptamukesh gupta
Hi Praneeth,

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


 
 
Praneeth YanamadalaPraneeth Yanamadala
Thank you Mukesh. But why is that trialhead challenge not accepting @isTest in the solution?
mukesh guptamukesh gupta
Hi Praneeth,

Can you please give me the Trailhead url, i will check my side

Regards
Mukesh
Baya AdamBaya Adam
Information Transformation Service provides  web scraping Services that provides high-quality structured data to improve business outcomes and enable intelligent decision making,their Web scraping service allows you to scrape data from any websites and transfer web pages into an easy-to-use format such as Excel, CSV, JSON and many others.
 
Suraj Tripathi 47Suraj Tripathi 47
Hi Praneeth,
 We use @isTest annotation before Classes and methods in Test Class.
 This is sample code.
@isTest
private class MyTestClass {
   // Methods for testing
   @isTest static void test1() {
      // Implement test 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
mukesh guptamukesh gupta
Hi Praneeth,

i can invistigate this issue if you share details, and willl try to provide better solution

Regards
Mueksh