我第一次与量角器合作,我已经安装了一些模块,包括量角器、量角器-trx-记者、茉莉花-trx-记者和网络驱动程序经理。Selenium服务器运行在默认的4444端口上,当我通过命令行(打开浏览器,测试通过)在本地运行时,测试似乎运行良好。
一切似乎没有任何错误,但我找不到trx文件发表的量角器-trx-记者。当我运行protractor conf.js
时,测试就开始了,命令行输出显示它正在导出trx报告并将输出文件设置为ProtractorTestResults.trx,但是.trx文件不会出现在任何地方,因此我怀疑它不是发布文件,而是没有抛出错误。
如果量角器- trx -记者没有导出trx文件,有什么想法吗?
下面是我的配置文件和规范文件的样子(这两个文件都是从量角器和量角器-trx-报告站点获取的)
//conf.js
exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js'],
onPrepare: function () {
console.log('Adding TRX reporter');
require('protractor-trx-reporter');
jasmine.getEnv().addReporter(new jasmine.TrxReporter('ProtractorTestResults.trx'));
}
}
//spec.js
describe('angularjs homepage todo list', function() {
it('should add a todo', function() {
browser.get('https://angularjs.org');
element(by.model('todoList.todoText')).sendKeys('write first protractor test');
element(by.css('[value="add"]')).click();
var todoList = element.all(by.repeater('todo in todoList.todos'));
expect(todoList.count()).toEqual(3);
expect(todoList.get(2).getText()).toEqual('write first protractor test');
// You wrote your first test, cross it off the list
todoList.get(2).element(by.css('input')).click();
var completedAmount = element.all(by.css('.done-true'));
expect(completedAmount.count()).toEqual(2);
});
});
发布于 2016-06-22 23:27:58
最后,我使用了jasmine记者,下面是conf.js的样子:
// conf.js
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
directConnect: true,
specs: ['spec.js'],
capabilities: {
'browserName': 'chrome'
},
onPrepare: function () {
var trx = require('jasmine-trx-reporter');
return browser.getCapabilities().then(function (caps) {
var browserName = caps.get('browserName').toUpperCase();
var jasmineTrxConfig = {
reportName: 'Protractor Test Results',
folder: 'testResults',
outputFile: 'Test.trx',
browser: browserName,
groupSuitesIntoSingleFile: false
};
jasmine.getEnv().addReporter(new trx(jasmineTrxConfig));
});
}
};
发布于 2016-06-22 19:57:35
我认为这可能是答案:
"...short术语我们不会增加对Jasmin2.0的支持。稍后可能会的,但我不能向你保证约会。“
这太让人心烦了。我也有同样的问题。茉莉花-trx-记者也不为我工作。
来源:[https://github.com/hatchteam/protractor-trx-reporter/issues/2]
https://stackoverflow.com/questions/37554261
复制相似问题