+ Start a Discussion
kito kidkito kid 

Test methods for schedular which call the method of external end point

Hi everyone,

I am new to apex and have some questions.


Below are my conditions.

I have class A_Class in which it calls the external end point in some methods.

To test this class, I have already written HTTP mock class and succesfully tested.

I have a schedular class, which calls A_Class to start to run its main method.

I want to test that schedular class.

But when I directly run the schedular with test class, it hits exception because of [TestMethod do not support Web service callouts].

I successfully tested A_Class with HTTP mock class, now I only want to test my schedular whether it is running at sepcific time correctly.


Do I need to comment out the calling of A_Class from schedular when I run test class? If I comment it out, just afraid it gives me problem when I deploy to Production.


How should I approach that kind of situation?


Thanks ahead. Any hints or ideas will be so useful for me.