0
我已经开始为我的REST API编写测试用例。以下是代码。我没有获得个别测试用例的状态(通过/失败,测试用例名称等)。我知道有一些很琐碎,我很想念摩卡测试执行|个别测试用例无状态
代码:
**var supertest = require("supertest");
var should = require("should");
// This agent refers to PORT where program is runninng.
var server = supertest.agent("http://localhost:1337");
// UNIT test begin
describe("SAMPLE unit test",function(){
// #1 should return home page
it("should return login details",function(done){
// calling Login api
server
.post('/login')
.send({ loginid: "8787878787", password : "temp"})
.expect("Content-type",/json/)
.expect(200)
.end(function(err,res){
res.status.should.equal(200);
res.body.notFound.should.equal(false);
res.body.data.customerId.should.equal(20);
done();
});
});
it("should return no active user",function(done){
// calling home page api
server
.post('/login')
.send({ loginid: "8787878787", password : "temp1"})
.expect("Content-type",/json/)
.end(function(err,res){
res.body.notFound.should.equal(true);
done();
});
});
});**
在命令提示符这是输出。它没有显示单独的测试用例状态(名称 - 在“它”块中所描述的内容,每个测试用例已经花费了多少时间等)
。 2合格(7s)
让我知道如何显示个别测试用例状态。
谢谢!这已解决。 – Swapna