Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Testing Rework #297

Closed
wants to merge 1 commit into from

3 participants

@tombell

To bring a lot more testability to hubot I'm working on reworking the included test framework and making it more user friendly. Hopefully this can flow over to the hubot-scripts repo as well.

If you have any ideas/suggestions/tips for the direction of the testability, mention it in a comment and let's get this rolling.

Edit: another goal is to get the test suite running on Travis-CI. :)

@atmos

Put it on travis-ci! :)

@tombell
@tombell

Spent the last 2 hours trying to get my own fork testing on travisci, and it's... well not even working. So either it doesn't work or there is something between the github service hook and travisci not working.

@technicalpickles

:+1: for better testability. I had looked at it before, but it was pretty tough to grok, and doesn't seem super organized.

Maybe could use something like nodeunit or jasmine or coffee-spec to organze the individual tests within each file?

@tombell tombell referenced this pull request in github/hubot-scripts
Closed

Redo testing #441

@tombell

Started spiking this in a branch in my own fork so I could hook it up with travis-ci at the same time.

Example build: http://travis-ci.org/#!/tombell/hubot/builds/1504780
Branch: https://github.com/tombell/hubot/tree/nodeunit

@technicalpickles

@tombell Awesome! Looks like a good start, but I think the tough part is going to be the robot test.

I've looked at the original one several times, but never was able to get a good grasp of what it was specifically testing. Maybe that's a sign that it should just be tossed and we add as stuff is updated.

@tombell

Closing this in favor of my nodeunit branch in my fork.

@tombell tombell closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 30, 2012
  1. @tombell
This page is out of date. Refresh to see the latest.
View
2  Makefile
@@ -3,7 +3,7 @@ NPM_EXECUTABLE_HOME := node_modules/.bin
PATH := ${NPM_EXECUTABLE_HOME}:${PATH}
test: deps
- @find test -name '*_test.coffee' | xargs -n 1 -t coffee
+ @find test -name 'test_*.coffee' | xargs -n 1 -t coffee
dev: generate-js
@coffee -wc --bare -o lib src/*.coffee
View
1  test/tests.coffee → test/helper.coffee
@@ -1,5 +1,4 @@
Url = require 'url'
-Path = require 'path'
Robot = require '../src/robot'
Adapter = require '../src/adapter'
View
1  test/test_adapter.coffee
@@ -0,0 +1 @@
+# TODO
View
0  test/brain_test.coffee → test/test_brain.coffee
File renamed without changes
View
1  test/test_creator.coffee
@@ -0,0 +1 @@
+# TODO
View
11 test/google_images_test.coffee → test/test_google_images.coffee
@@ -1,14 +1,13 @@
-Tests = require './tests'
assert = require 'assert'
-helper = Tests.helper()
-Robot = require '../src/robot'
+Helper = require './helper'
+helper = Helper.helper()
+
{TextMessage} = require '../src/message'
require('../src/scripts/google-images') helper
-# start up a danger room for google images
-danger = Tests.danger helper, (req, res, url) ->
+danger = Helper.danger helper, (req, res, url) ->
res.writeHead 200
res.end JSON.stringify(
responseData:
@@ -17,7 +16,6 @@ danger = Tests.danger helper, (req, res, url) ->
]
)
-# callbacks for when hubot sends messages
mu = "http://mustachify.me/?src="
tests = [
(msg) -> assert.equal "#{mu}(foo)#.png", msg
@@ -30,7 +28,6 @@ tests = [
(msg) -> assert.equal "(animated foo)#.png", msg
]
-# run the async tests
messages = [
'helper: stache me foo',
'helper: stache foo',
View
1  test/test_listener.coffee
@@ -0,0 +1 @@
+# TODO
View
1  test/test_message.coffee
@@ -0,0 +1 @@
+# TODO
View
8 test/robot_test.coffee → test/test_robot.coffee
@@ -1,7 +1,7 @@
-Tests = require './tests'
assert = require 'assert'
-helper = Tests.helper()
-require './scripts/test'
+
+Helper = require './helper'
+helper = Helper.helper()
server = require('http').createServer (req, res) ->
res.writeHead 200
@@ -23,7 +23,6 @@ server.listen 9001, ->
assert.equal 3, helper.sent.length
assert.ok helper.sent[2].match(/^(1|2)$/)
-
# Test that when we message a room, the 'recipient' is the robot user and the room attribute is set properly
helper.messageRoom "chat@example.com", "Hello room"
assert.equal 4, helper.sent.length
@@ -35,7 +34,6 @@ server.listen 9001, ->
assert.equal 5, helper.sent.length
assert.equal 'catch-all', helper.sent[4]
-
# set a callback for when the next message is replied to
helper.cb = (msg) ->
assert.equal 6, helper.sent.length
View
6 test/rules_test.coffee → test/test_rules.coffee
@@ -1,6 +1,8 @@
-Tests = require './tests'
assert = require 'assert'
-helper = Tests.helper()
+
+Helper = require './helper'
+helper = Helper.helper()
+
require('../src/scripts/rules') helper
tests = [
View
2  test/user_test.coffee → test/test_user.coffee
@@ -1,6 +1,6 @@
-User = require '../src/user'
assert = require 'assert'
+User = require '../src/user'
user = new User "Fake User", {name: 'fake', type: "groupchat"}
assert.equal "Fake User", user.id
Something went wrong with that request. Please try again.