使用Jenkins设置量角器的连续集成 [英] Setting up Continuous Integration of Protractor using Jenkins
问题描述
需要执行的任务是:
- 启动selenium standalon伺服器。
- 使用conf.js档案开始测试。
- 停止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:
- Starting the selenium standalon server.
- Starting the test using conf.js file.
- 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屋!