Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 在jenkins上运行量角器测试_Angularjs_Selenium_Gruntjs_Jasmine_Protractor - Fatal编程技术网

Angularjs 在jenkins上运行量角器测试

Angularjs 在jenkins上运行量角器测试,angularjs,selenium,gruntjs,jasmine,protractor,Angularjs,Selenium,Gruntjs,Jasmine,Protractor,我正在尝试使用jasmine reporter插件为jenkins生成报告 我的量角器配置为: exports.config = { allScriptsTimeout: 99999, seleniumAddress: 'http://localhost:4444/wd/hub', capabilities: { 'browserName': 'chrome' }, baseUrl: 'http://localhost:9000/', framework: 'jasmine2', spe

我正在尝试使用jasmine reporter插件为jenkins生成报告

我的量角器配置为:

exports.config = {
allScriptsTimeout: 99999,
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
    'browserName': 'chrome'
},
baseUrl: 'http://localhost:9000/',
framework: 'jasmine2',
specs: ['../test/e2e/**/*.js'],
onPrepare: function() {
   var jasmineReporters = require('jasmine-reporters');
    jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
        consolidateAll: true,
        filePrefix: 'test_results_e2e'
    }));
},

jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 60000,
    print: function() {}
}
};
生成了带有测试报告的文件,但测试失败,出现以下错误:

Failed: Angular could not be found on the page http://localhost:9000/# : retries looking for angular exceeded

我在用咕噜。因此,我定义了两个任务,一个用于测试,另一个用于开发。这两个任务使用不同的配置文件,唯一的区别是执行“grunt测试”应生成文件报告,而“grunt开发”执行测试并监视更改。所以,若我使用“dev”任务运行应用程序,那个么我不会得到任何错误。但任务“test”仍然会生成有错误的文件。

您看到的错误表明您正在测试的页面不是角度应用程序。根据您提供的信息,我的猜测是您的
grunt dev
任务正在启动本地服务器并在端口9000上为您的应用程序提供服务,这允许测试正常工作,但您的
grunt test
任务没有启动本地服务器,因此您的应用程序实际上没有在端口9000上运行