我们可以在使用Protractor-multiple-cucumber-html-reporter-plugin时在html报告生成中打印使用的测试数据

问题描述 投票:0回答:1

我正在使用量角器黄瓜框架进行自动化测试。我正在使用Protractor-multiple-cucumber-html-reporter-plugin生成报告。我们可以在报告中使用打印测试数据吗?要么至少,我们可以在显示错误消息的报告中打印故障测试用例的测试数据吗?

protractor automated-tests cucumber e2e-testing cucumberjs
1个回答
0
投票

是,可以。将您的测试数据放入Buffer(这是一个节点js概念),并将其附加到this.world,就像下面在hooks文件中一样]

   After(async function () {
    const userDetails = Buffer.from(JSON.stringify(Shared.userDetails));
    await this.World.attach(userDetails, 'application/json');
    const testData = Buffer.from(JSON.stringify(Shared.testDataObj));
    await this.World.attach(testData, 'application/json');
});

[最后,黄瓜将从this.world中获取全部数据,并将其存储在Cucumber-json-report.json中,我们将使用它在Cucumber-html-reporter的帮助下生成报告。

© www.soinside.com 2019 - 2024. All rights reserved.