【问题标题】:Run protractor e2e tests in TFS build在 TFS 构建中运行量角器 e2e 测试
【发布时间】:2016-05-03 16:01:06
【问题描述】:

我应该如何配置我的 TFS 构建以使其能够在 browserstack 中运行量角器 e2e 测试,并返回一些测试失败的 html 报告?我是 TFS 的新手。我可以在我的机器上手动完成,但不确定我是否可以在 TFS 中完成。 这是我的量角器配置的样子:

var project = 'testProject',
build = 'build_4',
acceptSslCerts = 'true';

var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');

var reporter = new HtmlScreenshotReporter({
dest: './html-report/',
filename: 'my-report.html',
reportOnlyFailedSpecs: false,
captureOnlyFailedSpecs: true,
showSummary: true,    
});

module.exports.config = {
framework: 'jasmine2',
seleniumAddress: 'http://hub.browserstack.com/wd/hub', /*  'http://localhost:4444/wd/hub', */
allScriptsTimeout: 40000,
specs: [    'test-spec.js'    ],
 capabilities: {
     browserName: 'chrome',
     loggingPrefs: { driver: 'ALL', server: 'ALL', browser: 'ALL' },
     'build' : 'version3',
     'project' : 'newintropage',
     'browserstack.user': 'browserstack.user',
     'browserstack.key': 'browserstack.key',        
     'browser': 'Edge',
     'browser_version': '13.0',
     'os': 'Windows',
     'os_version': '10',
     'resolution': '1024x768',

     'acceptSslCerts': acceptSslCerts
 },    
jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 40000
},
// Setup the report before any tests start
beforeLaunch: function () {
    return new Promise(function (resolve) {
        reporter.beforeLaunch(resolve);
    });
},
onPrepare: function () {       
    jasmine.getEnv().addReporter(reporter);
},
// Close the report after all tests finish
afterLaunch: function (exitCode) {
    return new Promise(function (resolve) {
        reporter.afterLaunch(resolve.bind(this, exitCode));
    });
}
};

这就是我的 tfs 构建的样子:

【问题讨论】:

    标签: testing tfs protractor tfsbuild browserstack


    【解决方案1】:

    根据屏幕截图,您正在使用 vNext 构建,并且您选择了默认的“Visual Studio”构建模板。

    TFS vNext 构建系统是基于任务的,非常灵活。我对量角器e2e测试不熟悉,但是基于description of Protractor,至少你需要使用npm来安装两个命令行工具,protractorwebdriver-manager,所以默认的“Visual Studio" 构建模板无法满足您的要求。

    您需要通过specifying your build steps 自定义您自己的构建模板。例如安装protractorwebdriver-manager需要添加npm步骤,运行protractor conf.js命令需要添加Command Line步骤。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-15
      • 1970-01-01
      • 1970-01-01
      • 2016-10-09
      • 1970-01-01
      • 2013-09-21
      • 2011-12-07
      • 1970-01-01
      相关资源
      最近更新 更多