API自动化测试与持续集成

发表于:2016-5-17 08:44

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:巴索罗米杰    来源:51Testing软件测试网采编

  执行
  命令
  gulp master
  结果
  ?  SuperTestWithGulp git:(master) gulp master
  [17:34:44] Using gulpfile ~/Downloads/SuperTestWithGulp/gulpfile.js
  [17:34:44] Starting 'master'...
  [17:34:44] Finished 'master' after 37 ms
  You are in master
  Test Demo.
  ? Visit http://aimer1124.github.io/ (502ms)
  1 passing (506ms)
  结果分析:? Visit http://aimer1124.github.io/ (502ms)表示测试正常通过;1 passing (506ms)表示整个测试所执行的时间和测试所执行的数量
  自动化测试的持续集成
  持续集成是什么
  Continuous Integration (CI) is a development practice that requires developers to integrate code into a shared repository several times a day. Each check-in is then verified by an automated build, allowing teams to detect problems early.
  Travis CI
  在线CI工具
  官网:https://travis-ci.org/
  Travis与Gulp集成
  使用Git项目SuperTestWithGulp
  在项目根目录中添加.travis.yml文件,language表示使用的语言为node_js,0.12表示使用node_js的版本,before_script表示运行脚本前执行的脚本命令,script表示启动时的执行脚本
  language: node_js
  node_js:
  - "0.12"
  before_script:
  - npm install -g gulp
  script: gulp master
  在Travis中关联此Github项目SuperTestWithGulp
  Travis会在Github代码有变更时,自动拉取项目的代码并进行在线集成
  Jenkins
  Build great things at any scale
  官网:https://jenkins.io/
  Jenkins与Grunt集成
  安装NodeJS、Git插件
  配制Job的build step中execute shell
  运行Job即可执行API测试
  
  总结
  API自动化测试已经说完了,完全没有太复杂的代码和编写难度。
  使用SuperTest可实现多场景、多环境的API场景测试,且执行速度较UI自动化测试快很多。
  SuperTest与Grunt/Gulp的集成很方便,即使在本地进行调试也很快捷。
  持续集成工具Travis/Jenkins,与API测试集成后,更高效的提高测试效率。
22/2<12
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号