httprunner2.3自动化测试报告脚本
‘utf-8‘/> ‘description‘ content=‘‘/> ‘robots‘ content=‘noodp, noydir‘/> ‘viewport‘ content=‘width=device-width, initial-scale=1‘/> "timeStampFormat" name="timeStampFormat" content=‘MMM d, yyyy hh:mm:ss a‘/> ‘https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600‘ rel=‘stylesheet‘ type=‘text/css‘> "https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> ‘http://extentreports.com/resx/dist/css/extent.css‘ type=‘text/css‘ rel=‘stylesheet‘/>{{ html_report_name }} - TestReport class=‘extent standard default hide-overflow dark‘>‘theme-selector‘ alt=‘切换主题,默认黑色‘ title=‘切换主题‘> class=‘material-icons‘>desktop_windowsclass=‘container‘>> >‘test-view‘ class=‘view‘>‘controls‘> class=‘controls grey lighten-4‘>class=‘chip transparent‘> class=‘dropdown-button tests-toggle‘ data-activates=‘tests-toggle‘ data-constrainwidth=‘true‘ data-beloworigin=‘true‘ data-hover=‘true‘ href=‘#‘> class=‘material-icons‘>warning 状态‘tests-toggle‘ class=‘dropdown-content‘>
- ‘pass‘>‘#!‘ onclick="filters_testcases(this.type)" type="pass" >成功class=‘material-icons green-text‘>check_circle
- ‘fail‘>‘#!‘onclick="filters_testcases(this.type)" type="fail" >失败class=‘material-icons red-text‘>cancel
- class=‘divider‘>
- ‘clear‘ clear=‘true‘>‘#!‘ onclick="filters_testcases(this.type)" type="clear" >清空 <i class=‘material-icons‘>clear
class=‘chip transparent hide‘> class=‘‘ id=‘clear-filters‘ alt=‘Clear Filters‘ title=‘Clear Filters‘> class=‘material-icons‘>close Clear‘toggle-test-view-charts‘ class=‘chip transparent‘> class=‘pink-text‘ id=‘enable-dashboard‘ alt=‘Enable Dashboard‘ title=‘Enable Dashboard‘> class=‘material-icons‘>track_changes 看板切换class=‘chip transparent‘ alt=‘Search Tests‘ title=‘Search Tests‘> "#" class=‘search-div‘> class=‘material-icons‘>search 查找class=‘input-field left hide‘> "color: red" id=‘search-tests‘ type=‘text‘ class=‘validate browser-default‘ placeholder=‘Search Tests...‘>‘test-view-charts‘ class=‘subview-full noncar-seventy-five‘>‘charts-row‘ class=‘noncar-wrap‘>class=‘ noncar-inside‘>class=‘noncar-title‘>class=‘left panel-name‘>驾驶舱接口自动化测试报告class="noncar-content">class="noncar-content-l" >class=‘block text‘> class=‘strong tooltipped‘ data-position=‘top‘>总测试: {{ stat.testcases.total }}class=‘block text‘> class=‘strong tooltipped‘ data-position=‘top‘>成功: {{ stat.testcases.success }}class=‘block text‘> class=‘strong tooltipped‘ data-position=‘top‘>失败: {{ stat.testcases.fail }}class="noncar-content-r" style="-webkit-tap-highlight-color: transparent; user-select: none; position: relative; background: transparent;">class=‘chart-box‘ width="369" height="140" data-zr-dom-id="zr_0" style="position: absolute; left: 0px; top: 0px; width: 369px; height: 140px; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); padding: 0px; margin: 0px; border-width: 0px;">‘charts-row‘ class=‘noncar-wrap‘>class=‘ noncar-inside‘>class=‘noncar-title‘>class=‘left panel-name‘>测试详情class="noncar-content">class="noncar-content-l" >class=‘block text‘> class=‘strong tooltipped‘ data-position=‘top‘>总数: {{ stat.teststeps.total }}class=‘block text‘> class=‘strong tooltipped‘ data-position=‘top‘>成功: {{ stat.teststeps.successes }}class=‘block text‘> class=‘strong tooltipped‘ data-position=‘top‘>失败: {{ stat.teststeps.failures }}class=‘block text‘> class=‘strong tooltipped‘ data-position=‘top‘>错误: {{ stat.teststeps.errors }}class=‘block text‘> class=‘strong tooltipped‘ data-position=‘top‘>跳过: {{ stat.teststeps.skipped }}class="noncar-content-r" style="-webkit-tap-highlight-color: transparent; user-select: none; position: relative; background: transparent;">class=‘chart-box‘ width="369" height="140" style="position: absolute; left: 0px; top: 0px; width: 369px; height: 140px; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); padding: 0px; margin: 0px; border-width: 0px;">class=‘subview-left left‘>class=‘view-summary‘>测试详情
‘test-collection‘ class=‘test-collection‘> {% for test_suite_summary in details %} {% if test_suite_summary.success == True %}
- class=‘test displayed active has-leaf pass‘ status=‘pass‘ bdd=‘true‘ test-id=‘{{ test_suite_summary.name }}_{{ loop.index }}‘> {% else %}
- class=‘test displayed active has-leaf fail‘ status=‘fail‘ bdd=‘false‘ test-id=‘{{ test_suite_summary.name }}_{{ loop.index }}‘> {% endif %}
class=‘test-heading‘> class=‘test-name‘>{{ test_suite_summary.name }} {% if test_suite_summary.success == True %} class=‘test-status right pass‘>成功 {% else %} class=‘test-status right fail‘>失败 {% endif %}class=‘test-content hide‘>{% endfor %}class=‘test-time-info‘> class=‘label start-time‘>{{ test_suite_summary.time.start_at }} class=‘label end-time‘>{{ ‘%0.3f‘| format(test_suite_summary.time.duration|float) }} secondsclass=‘test-desc‘>成功: {{ test_suite_summary.stat.successes }} ; 失败: {{ test_suite_summary.stat.failures }} ; 错误: {{ test_suite_summary.stat.errors }} 跳过: {{ test_suite_summary.stat.skipped }} ;class=‘collapsible node-list‘ data-collapsible=‘accordion‘> {% for record in test_suite_summary.records %} {% set record_index = "{}_{}".format(suite_index, loop.index) %} {% set record_meta_datas = record.meta_datas_expanded %} {% if record.status == ‘success‘ %}
- class=‘node level-1 leaf pass‘ status=‘pass‘ test-id=‘{{ test_suite_summary.name }}_{{ record.name }}_{{ loop.index }}‘> {% elif record.status == ‘failure‘ %}
- class=‘node level-1 leaf fail‘ status=‘fail‘ test-id=‘{{ test_suite_summary.name }}_{{ record.name }}_{{ loop.index }}‘> {% elif record.status == ‘error‘ %}
- class=‘node level-1 leaf error‘ status=‘error‘ test-id=‘{{ test_suite_summary.name }}_{{ record.name }}_{{ loop.index }}‘> {% elif record.status == ‘skipped‘ %}
- class=‘node level-1 leaf skip‘ status=‘skip‘ test-id=‘{{ test_suite_summary.name }}_{{ record.name }}_{{ loop.index }}‘> {% endif %}
{% endfor %}class=‘collapsible-header‘>class=‘node-name‘>{{ record.name }}class=‘node-duration‘>响应时间: {{ record.response_time }} ms {% if record.status == ‘success‘ %} class=‘test-status right pass‘>通过 {% elif record.status == ‘failure‘ %} class=‘test-status right fail‘>失败 {% elif record.status == ‘error‘ %} class=‘test-status right error‘>错误 {% elif record.status == ‘skipped‘ %} class=‘test-status right skip‘>跳过 {% endif %}class=‘collapsible-body‘> {% for meta_data in record_meta_datas %} {% set meta_data_index = loop%}class=‘node-steps‘> {% for req_resp in meta_data.data %}{% endfor %}class=‘bordered table-results‘>
{% endfor %}{% if record.status == ‘skipped‘ %} {% if record.attachment %} Status Params Details class=‘fail‘ status=‘fail‘> {% endif %} {% else %} {% if loop.index > 1 %}class=‘status fail‘ title=‘exception‘ alt=‘fail‘><i class=‘material-icons‘>cancel class=‘timestamp‘>traceback class=‘step-details‘> class="code-block">{{ record.attachment | e }}class="separator" align="center">==================================== redirect to ===================================={% endif %}class=‘info‘ status=‘info‘> {% if req_resp.request.method %}class=‘status info‘ title=‘接口地址‘ alt=‘info‘><i class=‘material-icons‘>low_priority class=‘timestamp‘>url class=‘step-details‘>{{ req_resp.request.url }} class=‘info‘ status=‘info‘> {% endif %}class=‘status info‘ title=‘请求方式‘ alt=‘info‘><i class=‘material-icons‘>low_priority class=‘timestamp‘>method class=‘step-details‘>{{ req_resp.request.method }} class=‘info‘ status=‘info‘> {% for key, value in req_resp.request.items() %} {% if key != ‘url‘ and key != ‘method‘ and key != ‘start_timestamp‘ %}class=‘status info‘ title=‘状态码‘ alt=‘info‘><i class=‘material-icons‘>low_priority class=‘timestamp‘>status_code class=‘step-details‘>{{ req_resp.response.status_code }} class=‘warning‘ status=‘warning‘> {% endif %} {% endfor %} {% if meta_data_index.length > 1 %}class=‘status warning‘ title=‘{{ key }}‘ alt=‘warning‘><i class=‘material-icons‘>low_priority {% if key == "headers" %}class=‘timestamp‘>req_header {% else %}class=‘timestamp‘>{{ key }} {% endif %}class=‘step-details‘> {% if key == "headers" %} {% for header_key, header_value in req_resp.response.headers.items() %} {{ header_key }}: {{ header_value | e}}{% endfor %} {% else %} {{ value }} {% endif %}class="separator" align="center">==================================== request_{{meta_data_index.index}} ===================================={% endif%} {% for key, value in req_resp.response.items() %} {% if key != "elapsed_ms" and key != "response_time_ms" and key != "content_size" and key != "content_type" and key != "status_code" and key != "reason" and key != "ok" and key != "encoding" and key != "url" and value %}class=‘error‘ status=‘error‘> {% endif %} {% endfor %}class=‘status error‘ title=‘{{ key }}‘ alt=‘error‘><i class=‘material-icons‘>low_priority {% if key == "headers" %}class=‘timestamp‘>rsp_header {% else %}class=‘timestamp‘>{{ key }} {% endif %}class=‘step-details‘> {% if key == "headers" %} {% for header_key, header_value in req_resp.response.headers.items() %} class="code-block">{{ header_key }}: {{ header_value }}{% endfor %} {% elif key == "content" %} {% if "image" in req_resp.response.content_type %} "{{ req_resp.response.content }}" /> {% else %} {{ value }} {% endif %} {% elif key in ["text", "json"] %} {% if value is mapping%}{{ value | tojson | e }}{% else %}{{ value | e }}{% endif %} {% elif key == "cookies" %} {% for cookies_key, cookies_value in req_resp.response.cookies.items() %}{{ cookies_key }}: {{ cookies_value }}{% endfor %} {% else %} {{ value }} {% endif %}class=‘pass‘ status=‘pass‘> class=‘status pass‘ title=‘断言‘ alt=‘pass‘><i class=‘material-icons‘>low_priority class=‘timestamp‘>Validators "checkvalue" >
{% for validator in meta_data.validators %} check comparator expect value actual value result {% endfor %} {{validator.check | e}} {{validator.comparator}} {{validator.expect | e}} {{validator.check_value | e}} {% if validator.check_result == "pass" %}class="test-status pass">通过 {% elif validator.check_result == "fail" %}class="test-status fail">失败 {% elif validator.check_result == "unchecked" %}class="test-status skip">unchecked {% endif %}class=‘info‘ status=‘info‘> {% if record.attachment and meta_data_index.last %}class=‘status info‘ title=‘info‘ alt=‘info‘><i class=‘material-icons‘>low_priority class=‘timestamp‘>Statistics class=‘step-details‘> content_size(bytes): {{ meta_data.stat.content_size }}response_time(ms): {{ meta_data.stat.response_time_ms }}elapsed(ms): {{ meta_data.stat.elapsed_ms }}class=‘fail‘ status=‘fail‘> {% endif %} {% endif %}class=‘status fail‘ title=‘exception‘ alt=‘fail‘><i class=‘material-icons‘>cancel class=‘timestamp‘>traceback class=‘step-details‘> class="code-block">{{ record.attachment | e }}class=‘subview-right left‘>class=‘view-summary‘>class=‘test-name‘>
‘step-filters‘ class="right"> "pass" alt="pass" title="pass">‘#!‘ onclick="step_filter(this.type)" type="pass">class="material-icons green-text">check_circle "fail" alt="fail" title="fail">‘#!‘ onclick="step_filter(this.type)" type="fail"><i class="material-icons red-text">cancel class="text-lighten-1" status="error" alt="error" title="error">‘#!‘ onclick="step_filter(this.type)" type="error"><i class="material-icons pink-text ">error "skip" alt="skip" title="skip">‘#!‘ onclick="step_filter(this.type)" type="skip"><i class="material-icons teal-text">redo "clear" alt="Clear filters" title="Clear filters">‘#!‘ onclick="step_filter(this.type)" type="clear"><i class="material-icons">clear‘category-view‘ class=‘view hide‘>‘controls‘> class=‘controls grey lighten-4‘>class=‘chip transparent‘ alt=‘Search Tests‘ title=‘Search Tests‘> "#" class=‘search-div‘> class=‘material-icons‘>search Searchclass=‘input-field left hide‘> "color: red;" id=‘search-tests‘ type=‘text‘ class=‘validate browser-default‘ placeholder=‘Search Tests...‘>class=‘subview-left left‘>class=‘view-summary‘>Categories
‘category-collection‘ class=‘category-collection‘>
- class=‘category displayed active‘>
{% for test_suite_summary in details %}class=‘category-heading‘> class=‘category-name‘>All TESTCASES class=‘category-status right‘> class=‘label pass‘>{{ stat.testcases.success }} {% if stat.testcases.fail != 0 %} class=‘label fail‘>{{ stat.testcases.fail }} {% endif %}class=‘category-content hide‘>class=‘category-status-counts‘> class=‘label green accent-4 white-text‘>Passed: {{ stat.teststeps.successes }} class=‘label red lighten-1 white-text‘>Failed: {{ stat.teststeps.failures }} class=‘label blue lighten-1 white-text‘>Errored: {{ stat.teststeps.errors }} class="label yellow darken-2 white-text">Skipped: {{ stat.teststeps.skipped }}class=‘category-tests‘>class=‘bordered table-results‘>
{% for test_suite_summary in details %} Timestamp TestName Status "border: 1px solid #49cc90; background-color: rgba(73, 204, 144, .1)"> {% for record in test_suite_summary.records %}{{ ‘%0.3f‘| format(test_suite_summary.time.duration|float) }} s class=‘linked‘ test-id=‘{{ test_suite_summary.name }}_{{ loop.index }}‘>{{ test_suite_summary.name }} {% if test_suite_summary.success == True %}class=‘test-status pass‘>成功 {% else %}class=‘test-status fail‘>失败 {% endif %}{% endfor %} {% endfor %} {{ record.response_time }} ms class=‘linked‘ test-id=‘{{ test_suite_summary.name }}_{{ loop.index }}‘>{{ record.name }} {% if record.status == ‘success‘ %}class=‘test-status pass‘>成功 {% elif record.status == ‘failure‘ %}class=‘test-status fail‘>失败 {% elif record.status == ‘error‘ %}class=‘test-status error‘>错误 {% elif record.status == ‘skipped‘ %}class=‘test-status‘ style="color: #fbc02d">跳过 {% endif %}- class=‘category displayed active‘>
{% endfor %}class=‘category-heading‘> class=‘category-name‘>{{ test_suite_summary.name }} class=‘category-status right‘> class=‘label pass‘>{{ test_suite_summary.stat.successes }} {% if test_suite_summary.stat.failures != 0 %} class=‘label fail‘>{{ test_suite_summary.stat.failures }} {% endif %} {% if test_suite_summary.stat.errors != 0 %} class=‘label blue lighten-1‘>{{ test_suite_summary.stat.errors }} {% endif %} {% if test_suite_summary.stat.skipped != 0 %} class=‘label yellow darken-2‘>{{ test_suite_summary.stat.skipped }} {% endif %}class=‘category-content hide‘>class=‘category-status-counts‘> class=‘label green accent-4 white-text‘>Passed: {{ test_suite_summary.stat.successes }} class=‘label red lighten-1 white-text‘>Failed: {{ test_suite_summary.stat.failures }} class=‘label blue lighten-1 white-text‘>Errored: {{ test_suite_summary.stat.errors }} class="label yellow darken-2 white-text">Skipped: {{ test_suite_summary.stat.skipped }}class=‘category-tests‘>class=‘bordered table-results‘>
{% for record in test_suite_summary.records %} Timestamp TestName Status {% endfor %} {{ record.response_time }} class=‘linked‘ test-id=‘{{ test_suite_summary.name }}_{{ loop.index }}‘>{{ record.name }} {% if record.status == ‘success‘ %}class=‘test-status pass‘>成功 {% elif record.status == ‘failure‘ %}class=‘test-status fail‘>失败 {% elif record.status == ‘error‘ %}class=‘test-status error‘>错误 {% elif record.status == ‘skipped‘ %}class=‘test-status‘ style="color: #fbc02d">跳过 {% endif %}class=‘subview-right left‘>class=‘view-summary‘>class=‘category-name‘>
原文:https://www.cnblogs.com/camillezxl/p/14900693.html