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.
Example :
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 :
public
String Test(){
// Build the http request
// Invoke web service call
String result =
''
;
if
(!Test.isRunningTest()){
// Make a real callout since we are not running a test
}
else
{
// A test is running
result = Response;
}
return
result;
}
No comments:
Post a Comment