Test.isRunningTest() can be used to check whether the code is executed by test class.
Sample Code:
if ( !Test.isRunningTest() ) {
/*Code Block which won't execute during Test Class Execution*/
}
Test.isRunningTest() can be used to check whether the code is executed by test class.
Sample Code:
if ( !Test.isRunningTest() ) {
/*Code Block which won't execute during Test Class Execution*/
}