0.0.0 • Published 4 years ago

hq-unit-test v0.0.0

Weekly downloads
-
License
-
Repository
github
Last release
4 years ago

wanke-hq-test

自动生成测试代码工具

功能列表

  • 版本、参数集持久化(文件形式)
  • 读取参数文件,自动保存测试参数
  • 自动生成测试代码文件(基于Jest)
  • 测试覆盖率报告
  • 根据版本号一键生成相关测试套件

运行流程

npm install hq-test                                         // 添加依赖
hq-test -i <your test params path> -o <your export path>    // 将测试集文件按版本分类汇总
hq-test -t <your execute path>                              // 根据测试集自动生成测试文件

在package.json中增加一下代码

"scripts": {
    "test": "jest --coverage"
 }

在package.json中增加以上代码,运行npm run test执行测试文件并获取代码覆盖率

 PASS  test/example.test.js
  ✓ fibonacci (7ms)

------------|---------|----------|---------|---------|-------------------
File        | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
------------|---------|----------|---------|---------|-------------------
All files   |     100 |      100 |     100 |     100 |                   
 example.js |     100 |      100 |     100 |     100 |                   
------------|---------|----------|---------|---------|-------------------
Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        2.034s
Ran all test suites.