Activity Forums Salesforce® Discussions What is the purpose of Test.isRunningTest() in Salesforce? Reply To: What is the purpose of Test.isRunningTest() in Salesforce?

  • Kirandeep

    Member
    July 1, 2020 at 12:16 pm

    Test.isRunningTest() method is used to identify, if the piece of code being executed is invoked from a Test class execution or from other artefacts such as a Trigger, Bacth Job etc. Returns true if the code being executed is invoked from a test class otherwise returns a false.