使用Jenkins设置量角器的连续集成 [英] Setting up Continuous Integration of Protractor using Jenkins

查看:225
本文介绍了使用Jenkins设置量角器的连续集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



需要执行的任务是:


  1. 启动selenium standalon伺服器。

  2. 使用conf.js档案开始测试。

  3. 停止selenium独立服务器。

任何人都可以在这方面提供帮助?

解决方案

我创建了一个小 bash脚本来执行此操作。

 #start selenium 
./node_modules/protractor/bin/webdriver-manager start> / dev / null 2>& 1&

#等待,直到selenium up
while! curl http:// localhost:4444 / wd / hub / status&> / dev / null; do:; done

#运行构建
grunt cibuild --force

#stop selenium
curl -s -L http:// localhost:4444 / selenium-server / driver?cmd = shutDownSeleniumServer> / dev / null 2>& 1

此脚本从自由风格项目在jenkins中( Build>执行shell)





然后通过读取量角器测试结果生成测试结果报告。因此,您必须从量角器生成junit报告(查看 here ):

  onPrepare:function(){
// require语句必须这里,因为茉莉花记者
//需要茉莉花在全局和量角器不保证
//这直到在onPrepare函数内。
require('jasmine-reporters');
jasmine.getEnv()。addReporter(
new jasmine.JUnitXmlReporter('xmloutput',true,true));
},



为了使报表在jenkins中可见,我在job:发布JUnit测试结果报告




I am writing automation test scripts using Protractor and now I need to set up the CI for this using Jenkins.

Tasks it needs to perform are:

  1. Starting the selenium standalon server.
  2. Starting the test using conf.js file.
  3. Stopping the selenium standalone server.

Can anyone help in this regard?

解决方案

I created a small bash script to do this.

# start selenium
./node_modules/protractor/bin/webdriver-manager start > /dev/null 2>&1 &

# wait until selenium is up
while ! curl http://localhost:4444/wd/hub/status &>/dev/null; do :; done

# run the build
grunt cibuild --force

# stop selenium
curl -s -L http://localhost:4444/selenium-server/driver?cmd=shutDownSeleniumServer > /dev/null 2>&1

This script is invoked from a free-style project in jenkins (Build > Execute shell)

Then the test result report is generated by reading the protractor test results. Hence, you have to produce junit reports from protractor, (look here) :

onPrepare: function() {
  // The require statement must be down here, since jasmine-reporters
  // needs jasmine to be in the global and protractor does not guarantee
  // this until inside the onPrepare function.
  require('jasmine-reporters');
  jasmine.getEnv().addReporter(
    new jasmine.JUnitXmlReporter('xmloutput', true, true));
},

To make the report visible in jenkins i add a post build action in the job: Publish JUnit test result report:

这篇关于使用Jenkins设置量角器的连续集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆