How to avoid a particular block of code in test class execution in Salesforce?

Test.isRunningTest() is used to define whether the code is executed by test class.

Here is an example:

if(!Test.isRunningTest()) {
    //Your Code
}

Leave a Reply