Reply
Regular Contributor
gtindu
Posts: 52

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   Boolean Returns 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>

Contributor
ca_peterson_again
Posts: 4

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

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

Regular Contributor
gtindu
Posts: 52

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

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."

Regular Contributor
gtindu
Posts: 52

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

Documentation issue!

Should be:  Test.isRunningTest();