量角器& Jenkins上的Jasmine配置 [英] Protractor & Jasmine Configuration on Jenkins
问题描述
我正在尝试在Jenkins上为CTI配置Protractor ....我已经设置了Protractor和Jasmine并试图将它与Jenkins集成。
I am trying to configure Protractor on Jenkins for CTI.... I have already setup Protractor along with Jasmine and trying to get it integrated with Jenkins.
I经历了几个环节&互联网上的博客,但似乎没有提供有关如何使用Jenkins配置量角器的详细信息。
I have gone through several links & blogs on internet but none seem to be helpful in providing detailed information on how to get the Protractor configured with Jenkins.
任何帮助或指向正确的博客或视频都将非常感激。谢谢
Any help or pointing towards the right blog or video will be really appreciated. Thanks
推荐答案
@Vishal
请找到以下代码片段即可添加为grunt任务。
Please find the below snippet you can add as grunt task.
'use strict';
module.exports = function (grunt) {
grunt.initConfig({
exec: {
protractorRunAppsTest: {
cmd: 'C:\\Program Files\\nodejs\\node.exe C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\protractor\\built\\cli.js C:\\Jenkins\\workspace\\test\\conf.js'
}
},
server: {
port:3000,
base: ['app']
},
});
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-protractor-runner');
grunt.loadNpmTasks('grunt-run');
grunt.loadNpmTasks('grunt-exec');
grunt.registerTask('server', 'Start node server', function() {
grunt.log.writeln('Started server on port 3000');
require('./app.js');
});
grunt.registerTask('runAppsTest', ['exec:protractorRunAppsTest']);
};
将上述代码保存为Gruntfile.js
Save the above code as Gruntfile.js
确保它位于jenkins的工作区文件夹中。
Make sure this is in the workspace folder for jenkins.
在Jenkins工作中添加'Build'部分(我假设Jenkins是Windows服务器)
In Jenkins job add the 'Build' Section (i am assuming Jenkins is windows server)
add执行Windows批处理命令并将以下内容添加到那里的文本字段。
add "Execute Windows Batch Command" and add the below content to the text field there.
cd %WORKSPACE%
grunt server runAppsData || exit 0
我希望这对你有用。请尝试让我知道。
考虑评价我的答案。
I hope this would work for you. Please try and let me know. Consider rating my answer.
这篇关于量角器& Jenkins上的Jasmine配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!