2016-02-12 118 views
1

我有以下的配置,但得到错误如何在jenkins中设置和运行角度js量角器测试?

ERROR

 
registration capabilities Capabilities [{platform=WINDOWS, ensureCleanSession=true, browserName=internet explorer, version=}] does not match the current platform LINUX 
18:17:05.892 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped: 
registration capabilities Capabilities [{platform=WINDOWS, browserName=MicrosoftEdge, version=}] does not match the current platform LINUX 
18:17:05.896 INFO - Driver class not found: com.opera.core.systems.OperaDriver 
18:17:05.896 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered 
18:17:06.187 WARN - Failed to start: [email protected]:4444 
Exception in thread "main" java.net.BindException: Selenium is already running on port 4444. Or some other service is. 
    at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:492) 
    at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:305) 
    at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:245) 
    at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:64) 
Selenium Standalone has exited with code 1 
Selenium standalone server started at http://10.33.24.128:43448/wd/hub 

詹金斯命令

 
## run testing 
node_modules/protractor/bin/webdriver-manager update --standalone 
node_modules/protractor/bin/webdriver-manager start > /dev/null 2>&1 & 

while ! curl http://localhost:4444/wd/hub/status &>/dev/null; do :; done 

node_modules/protractor/bin/protractor protractor.conf.js 

我的配置文件低于

exports.config = { 
    directConnect: false, 

    capabilities: { 
    'browserName': 'chrome' 
    }, 
    chromeDriver: './node_modules/protractor/selenium/chromedriver', 
    seleniumAddress: 'http://localhost:4444/wd/hub', 
    framework: 'jasmine', 
    specs: ['tests/specs/*-spec.js'], 
    jasmineNodeOpts: { 
    showColors: true, 
    defaultTimeoutInterval: 30000 
    } 
};
+0

你'node_modules /量角器/斌/量角器protractor.conf.js --troubleshoot'得到什么输出? – alecxe

+0

@alecxe DEBUG - 与--troubleshoot DEBUG运行 - 量角器版本:3.1.1 DEBUG - 您的基本URL测试是不确定的 [发射]程序退出,错误代码1个 – bitecoder

回答

0

您有错误讯息:

Selenium已在4444端口上运行。或者其他一些服务是。

因此,您的测试失败,因为无法设置硒,因为它需要的端口已被使用。

这可能是可能是因为另一个构建并联同一台机器上运行,或者是因为硒不是由以前的生成停止,或者一些其他的服务器使用的端口4444

你需要确保这个在开始构建之前,端口是免费的。

您可以在同一台机器上限制多个并行运行的机器,这些机器要使用与Port Allocator pluginThrottle Concurrent Builds plugin相同的端口号。

+0

感谢。我是否必须在从属设备上安装chrome浏览器,或者使用量角器附带的chromedriver具有standanlone实例? – bitecoder

0

避免直接处理这一点,并委托其吞掉插件像gulp-angular-protractor到:

1)。开始/停止硒服务器

2)。而运行量角器测试

全部示例

Gulpfi le.js

/*jshint node: true, camelcase: false*/ 
/*global require: true*/ 

'use strict'; 

var gulp = require('gulp'), 
gulpProtractorAngular = require('gulp-angular-protractor'); 

// Setting up the test task 
gulp.task('regression-suite', function(callback) { 
    gulp 
     .src(['./tests/specs/*spec.js']) 
     .pipe(gulpProtractorAngular({ 
      'configFile': 'protractor.conf.js', 
      'debug': false, 
      'autoStartStopServer': true 
     })) 
     .on('error', function(e) { 
      console.log(e); 
     }) 
     .on('end', callback); 
}); 

conf.js

和以前一样

命令提示符

C:>gulp regression-suite 

詹金斯

添加工序执行Windows命令

gulp regression-suite 
相关问题