节点JS单元测试用例mysql

时间:2019-04-08 12:30:40

标签: mysql node.js mongodb unit-testing

我想为我的节点mysql rest api应用程序编写单元测试用例。

api调用过程:

route-> controller-> resources(models / Mysql)-> formatters-> controller-> response Factory。 现在,我想问一下如何为具有代码覆盖率的路由编写单元测试用例。

1 个答案:

答案 0 :(得分:0)

The unit test is not something that you are asking for. Unit Test is something testing smallest unit of your code. Eg. If you have multiple functions to satisfy your request and you are writing test cases to validate each method is unit test.

If you are writing the test code to for your route is called feature test or integration testing.

Please check this link Unit tests vs Functional tests

Once, you have understood the concept of unit testing and integration testing, There are few testing frameworks is available like chai, mocha you can start with these packages.