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
gtindugtindu 

API Version 20: System.isRunningTest() Method doesn't exist?!

When trying to utilize this on our Winter 11 sandbox - or in NA6 after update - 

Save error: Method does not exist or incorrect signature: System.isRunningTest()

 

Despite the API docs listing:

 

The following are the static methods for System.

isRunningTest BooleanReturns true if the currently executing code was called by code contained in a method 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.

 

 

And the apex class metadata:

<?xml version="1.0" encoding="UTF-8"?>
    <apiVersion>20.0</apiVersion>
    <status>Active</status>
</ApexClass>

 

<?xml version="1.0" encoding="UTF-8"?><ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">

    <apiVersion>20.0</apiVersion>

    <status>Active</status>
</ApexClass>

ca_peterson_againca_peterson_again

I'm having the same issue as well. Did this method get dropped from the release?

gtindugtindu

If they dropped it from release - how is anyone supposed to delineate if they are running in a test context now?  You used to be able to use the Limits object - but that's changed.

I submitted a case and got feedback from support just now

 

"Case#03955103 regarding isRunningTest()
I have escalated your case to tier3.I will let you know when will get any update from tier3."

gtindugtindu

Documentation issue!

Should be:  Test.isRunningTest();