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

How to use isRunningTest from winter'11 new apex code features

I am trying to use the new system method "isRunningTest". This is introduced from winter'11.



Return Type : Boolean

Description: Returns true if the currently executing code was called by code contained in a method isRunningTest Boolean defined as testMethod, false otherwise. Use this method if you need to run different code depending on whether it was  being called from a test.


I have added folloiwng to one of my apex trigger


system.debug(' isRunningTest : '  + system.isRunningTest());


I am getting this error:


Error: Compile Error: Method does not exist or incorrect signature: system.isRunningTest() at line.


I have set the API version to 20.0 and I am still getting the same error


Has anyone already tried using it in the apex code




Best Answer chosen by Admin (Salesforce Developers) 

It is a Documentation issue!

Should be:  Test.isRunningTest();


Found it here :