cypress

200 阅读1分钟

安装

step1:安装vscode

step1:安装 Cypress

npm install cypress --save-dev

项目中就会多出来一个Cypress文件夹

step2:启动Cypress

.\node_modules.bin\cypress open

image.png

step3:在Cypress文件夹的integration目录下创建新目录MyTests,MyTests目录下创建文件myFirstTestSuites.js

step4: 即可在myFirstTestSuites.js中添加自动化测试

step6: 生成测试报告

cypress.json文件中添加如下配置

{
  "reporter": "junit",
  "reporterOptions": {
    "mochaFile": "results/test_report_[hash].xml", 
    "toConsole": true
  }
}

step5: 运行测试用例

(可以直接在可视化窗口运行测试用例,可以直观的看到测试用例运行步骤)

也可以在命令行下运行 yarn cypress run

step6:生成allure测试报告

执行命令allure serve results

安装参考

Cypress + allure 参考

allure

allure安装

scoop安装

使用