2016-05-02 7 views
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(); 
    }); 
    }); 
});** 

これが出力されます:私は

コード行方不明です非常に些細な何かがあることを理解します。個々のテストケースのステータス(名前、 "it"ブロックに記述されているもの、各テストケースがどれくらいの時間を費やしたかなど)は表示されません。

2回(7s)

個々のテストケースのステータスを表示する方法を教えてください。

+0

ありがとうございます!これは解決されました。 – Swapna

答えて

1

モカにはテストを表示するためのオプションがいくつかあります。あなたの場合は、Listとしたいと思うかもしれません。さらに多くのオプションがありますhere

ので、ターミナルで、あなたとあなたのテストを呼び出します - mocha -R list tests/test.js

また、あなたは1以上のものを持っている場合は、レポータータイプを毎回書くことからして間違いなくあなたを持っているモカのためのグローバル設定を使用することができますテストファイル。

関連する問題