node package manager


Full stack HTTP testing for Express


springboard makes it simple to write full-stack HTTP tests for your express applications. Let's start with a simple express application.

express = require "express"
app = express()
app.use express.bodyParser()
app.use express.methodOverride()
app.use app.router
app.get "/hello", (req, res) ->
  res.send "Hello, world!" "/post", (req, res) ->
  res.send "Hello, #{}!"
module.exports = app

Now, let's write some tests with springboard! We'll use the mocha testing framework and chai for assertions.

expect = require("chai").expect
springboard = require "springboard"
app = require "./"
describe "springboard", ->
  it "handles GET requests", (done) ->
    springboard.withServer app, (r) ->
      r.get "/hello", (err, result) ->
        expect(result).to.eql("Hello, world!")
  it "allows POST requests with form data", (done) ->
    springboard.withServer app, (r) -> "/post", {name: "Drew"}, (err, result, response) ->
        expect(result).to.eql("Hello, Drew!")
  it "allows POST requests with JSON data", (done) ->
    springboard.withServer app, (r) -> "/post", JSON.stringify({name: "Drew"}), (err, result, response) ->
        expect(result).to.eql("Hello, Drew!")

For more examples, take a look at the tests.

To install dependencies, compile the coffeescript and run the tests, just run


Now write some tests, make them pass and send me a pull request!