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
Lee.ax1423Lee.ax1423 

Writing Test Cases for Http callouts

Hi,

Can you tell me how to write test cases for Htttp callouts here is the sample code.

 

public PageReference Send() {

 

HttpRequest req = new HttpRequest();
    
    req.setEndpoint('url');
    req.setMethod('GET');

    //send the request
    Http http = new Http();
    HttpResponse res = http.send(req);

    //check the response
    if (res.getStatusCode() == 200) {

         //do something//

 } else {
      //do something
    } 

 

can you help me???

Lee.ax1423Lee.ax1423

Thnks for replying me,

 

but still i am confusing to write unit test cases for http callouts.

 

can you write unit test for above mentioned code........

 

thanks advance........