我有一个专用服务器,我正在使用电网进行测试。 我想从ow子测试套中操作服务器,这样,我就迫切需要使服务器在背景中运行,以便测试套能运行。 因此,我只能产生一个驾.任务,管理服务器,孤立地测试服务器。
<编码>server.coffee 我建立了(快车)服务器,配置了该服务器,铺设了线路,并称之为像仪表:
# Express - setup
express = require express
app = module.exports = express.createServer()
# Express - configure and set up routes
app.configure ->
app.set views , etc....
....
# Express - start
app.listen 3030
在我简单的<密码>中,js 我有:
vows = require( vows ),
assert = require( assert ),
server = require( ../app/server/server );
// Create a Test Suite
vows.describe( routes ).addBatch({
GET / : respondsWith(200),
GET /401 : respondsWith(401),
GET /403 : respondsWith(403),
GET /404 : respondsWith(404),
GET /500 : respondsWith(500),
GET /501 : respondsWith(501)
}).export(module);
<代码>respondsWith(代码)在功能上与ows doc中的功能相似。
When I require
server in the above test, it automatically begins running the server and the tests run and pass, which is great, but I dont feel like I am doing it the right way.
I dont have much control over when the server begins, and what happens if I want to configure the server to point to a test environment rather than the default one, or change the default logging level for when im testing?
我会把我的ow子改换成咖啡,但现在,它都是在 j子里,就像从docs中学习一样!