What kind of testing is this? Is the following considered end to end testing or is it an integration testing or a system testing? If not if you can elaborate on the types of testing in context of the code example.
I'm basically calling the endpoint on localhost and asserting on the status/output.
let assert = require("assert");
let http = require("http");
describe("EndToEndTesting", function() {
describe("GET /users", function() {
it("should return list of users", function(done) {
http.request({
method: "GET",
hostname: "localhost",
port: 3000,
path: "/users"
}, function(response){
let buffers = [];
response.on("data", buffers.push.bind(buffers));
response.on("end", function(){
let body = JSON.parse(Buffer.concat(buffers).toString());
assert(response.statusCode == 200);
});
}).on("error", console.error).end();
});
}
}
Aucun commentaire:
Enregistrer un commentaire