You need to sign in to do that
Don't have an account?
Sanu Verma
How to Pass IsTestRunning Condition in Test Class
How to Cover test.isRunningTest() in test class in if else conditon
for(String ownerId : ownerIds){ if(loggedInUsers != NULL && loggedInUsers.size() > 0){ String a; if(test.isRunningTest() == true){ a = null; System.debug(a); }else{ a = ownerId; System.debug(a); }
You have to use Test.IsRunningTest in your apex class, Not in Test class
Test.IsRunningTest is basically used If we want to cover the scenario of a code of our apex class is being covered by your Test class.
I am Refer you the following links do check it once before applying to Test.IsRunningTest
Hope this might helps you
Test.isRunningTest() :
1. This is not used in test classes but in other classes in order to verify if the call is from a test class.
2.Test.isRunningTest() is used to define whether the code is executed by test class.
Example :
http://michaelwelburn.com/2014/03/03/a-better-way-to-use-test-isrunningtest-in-apex/
Thanks
Akshay