How to do Backend Rest Api testing using Protractor?

Ask a question+
2

Hello! I am looking for an examples of end to end testing with Backend Rest Api testing included using protractor and jasmine? Any suggestions?

Sargsyan 580
add comment

1 Answer

2

Hi! Use “http” module available in nodeJs to make http request and then process the response recieved from the api call.
var http = require(‘http’);

var options = {
   host: 'example.com',
   port: 80,
   path: '/foo.html'
};

http.get(options, function(resp){
   resp.on('data', function(chunk){
   //do something with chunk
  });
}).on("error", function(e){
   console.log("Got error: " + e.message);
});
Ian 360
add comment

Your Answer