You need to sign in to do that
Don't have an account?

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.
isRunningTest
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
thanks
It is a Documentation issue!
Should be: Test.isRunningTest();
Found it here :
http://boards.developerforce.com/t5/Apex-Code-Development/API-Version-20-System-isRunningTest-Method-doesn-t-exist/m-p/207780#M36571