接口测试 pytest-html 生成测试报告 如何分类 以及隐藏失败信息日志

Elsie · 2020年02月26日 · 最后由 Elsie 回复于 2020年03月12日 · 2419 次阅读

问题 1:如何隐藏失败信息日志
如图 想将失败和跳过的具体信息隐藏掉 想看的时候再打开
查看官方文档
This behavior can be customized either with a query parameter: ?collapsed=Passed,XFailed,Skipped or by setting the render_collapsed in a configuration file (pytest.ini, setup.cfg, etc).
配置了 ini 不起作用 参数放在 pytest_html_results_table_html pytest_html_results_table_row 等地方也不起做用?

问题 2:由于接口很多 想要分类整理 不知道可不可以在报告中实现像 allure 那样分类的功能
望大神赐教 非常感谢

共收到 4 条回复 时间 点赞

为何不直接用 allure 呢,我之前也是需要按模块划分用例,就从 pytest-html 转到了 allure

pytest-html 中的 main.js 中 init 函数新增方法:hide_all_extras();

function init () {
    reset_sort_headers();

    add_collapse();

    show_filters();

    toggle_sort_states(find('.initial-sort'));

    find_all('.sortable').forEach(function(elem) {
        elem.addEventListener("click",
                              function(event) {
                                  sort_column(elem);
                              }, false)
    });

    hide_all_extras();

};

BlackChainLife 回复

很受用 非常感谢

不知道 allue 怎么搞邮件报告 就不用了

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册