Skip to content

Testing

Liana Lo edited this page Dec 19, 2014 · 4 revisions

Go

In order to run the tests, first install Go's testify package with the command

dashboard-controller$ go get github.com/stretchr/testify

There are two ways to run the unit tests. In case you wish to run only one test file, then navigate into the directory where the test file is located, and run the tests with 'go test'. For example, in the master directory that contains master.go and master_test.go, run

dashboard-controller/src/master$ go test 

You can also run the tests from the root directory by specifying the package name after 'go test'.

dashboard-controller$ go test master

The -cover flag will output the test coverage %.

dashboard-controller/src/master$ go test -cover

For more testing options, please see the this Go blog post.

CoffeeScript

We use the Mocha testing framework with Chai assertions. You also need to install Node.js. We recommend using npm for installing Mocha and Chai. You can install Mocha by using npm.

npm install -g mocha

Similarly, Chai can be installed by the following command.

npm install chai

You can run the tests from the root folder of the Hubot application by the following command.

dashboard-controller/src/dashboard-hubot$ make test