【发布时间】:2017-01-29 16:51:00
【问题描述】:
我正在尝试为我的量角器项目进行 Jenkins 集成。我正在使用量角器 Jasmine 来编写测试。我在 Visual Studio 中使用 nodeJs 配置项目。
我可以手动运行所有测试。现在,我的目标是尝试 Jenkins 集成,以便我的项目可以持续运行。
请建议我的方式或任何有用的媒体。 我的“RunConf.js”文件如下。我使用这个文件来运行这两个套件。
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
exports.config = {
framework: 'jasmine2',
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities:
{
'browserName': 'chrome',
'shardTestFiles': true,
'maxInstances': 2,
chromeOptions: {
args: ['chrome.switches', '--disable-extensions']
}
},
suites: {
loginpage: 'login.js',
addproduct: 'addproduct.js'
},
//specs: ['addproduct.js'],
jasmineNodeOpts: {
onComplete: null,
isVerbose: false,
includeStackTrace: true,
showColors: true,
defaultTimeoutInterval: 30000
},
onPrepare: function () {
browser.driver.ignoreSynchronization = true;
return new Promise(function(fulfill, reject) {
browser.getCapabilities().then(function(value) {
reportName = value.get(Math.random(8,2)) + '_' + value.get('browserName') + '_' + Math.floor(Math.random() * 1E16);
jasmine.getEnv().addReporter(
new Jasmine2HtmlReporter({
//cleanDestination: false,
savePath: 'target/',
docTitle: 'Web UI Test Report',
screenshotsFolder: 'image',
//takeScreenshots: true,
takeScreenshotsOnlyOnFailures: true,
consolidate: true,
consolidateAll: true,
// preserveDirectory: true,
//fixedScreenshotName: true,
filePrefix: reportName + ".html"
})
);
fulfill();
});
});
},
afterLaunch: function afterLaunch() {
var fs = require('fs');
var output = '';
fs.readdirSync('target/').forEach(function(file) {
if (!(fs.lstatSync('target/' + file).isDirectory()))
output = output + fs.readFileSync('target/' + file);
});
fs.writeFileSync('target/ConsolidatedReport.html', output, 'utf8');
}
}
【问题讨论】:
-
如果您自己尝试设置并在此处详细发布任何特定问题/问题,您更有可能得到回复。您的问题涵盖了各种主题,这些主题在某些方面可能非常主观,而且通常范围相当大/广泛......几乎无法回答。
标签: node.js jenkins jasmine continuous-integration protractor