mirror of https://gitee.com/bigwinds/arangodb
37 lines
891 B
Plaintext
37 lines
891 B
Plaintext
!CHAPTER Using jsUnity and node-jscoverage
|
|
|
|
|
|
!SUBSECTION jsUnity
|
|
|
|
The ArangoDB contains a wrapper for [jsUnity](http://jsunity.com/), a
|
|
lightweight universal JavaScript unit testing framework.
|
|
|
|
!SUBSECTION Running jsUnity Tests
|
|
|
|
Assume that you have a test file containing
|
|
|
|
```js
|
|
function exampleTestSuite () {
|
|
return {
|
|
testSizeOfTestCollection : function () {
|
|
assertEqual(5, 5);
|
|
};
|
|
}
|
|
|
|
jsUnity.run(aqlTestSuite);
|
|
|
|
return jsunity.done();
|
|
```
|
|
|
|
Then you can run the test suite using *jsunity.runTest*
|
|
|
|
```
|
|
arangosh> require("jsunity").runTest("test.js");
|
|
2012-01-28T19:10:23Z [10671] INFO Running aqlTestSuite
|
|
2012-01-28T19:10:23Z [10671] INFO 1 test found
|
|
2012-01-28T19:10:23Z [10671] INFO [PASSED] testSizeOfTestCollection
|
|
2012-01-28T19:10:23Z [10671] INFO 1 test passed
|
|
2012-01-28T19:10:23Z [10671] INFO 0 tests failed
|
|
2012-01-28T19:10:23Z [10671] INFO 1 millisecond elapsed
|
|
```
|