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