You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Allure Framework图表不显示求助:分类趋势、概述趋势缺失

Troubleshooting Missing Allure Charts with Python-Behave (Allure 2.5.0)

Let's break down why you're only seeing the default Severity and Duration charts, plus missing Categories Trend and an empty Overview Trend section. Here are the most likely fixes to try:

1. Fix Version Compatibility Issues

Allure 2.5.0 is a fairly old release, and it might not play nicely with the version of allure-behave you're using. Mismatched versions often lead to incomplete widget data.

  • First, upgrade the allure-behave plugin to a compatible version:
    pip install --upgrade allure-behave
    
  • Then, consider upgrading your Allure command-line tool to a newer stable release (e.g., 2.20.0) — older versions have known bugs around trend and category chart generation.

2. Ensure Historical Test Data is Preserved

The Overview Trend section relies on previous test run data to render trends. If you're starting fresh every time, there's no data to display. Here's how to retain history:

  • Before running a new test suite, copy the existing history folder from your old allure-results to the new results directory:
    # Replace "old-allure-results" with your previous results path
    if [ -d old-allure-results/history ]; then cp -r old-allure-results/history allure-results/; fi
    
  • Run your behave tests with the Allure formatter:
    behave -f allure_behave.formatter:AllureFormatter -o allure-results
    
  • Generate the report with the updated history:
    allure generate allure-results -o allure-report
    
    Now the Trend section should populate once you have at least two test runs saved.

3. Add a Custom Categories Configuration

The Categories Trend chart won't appear unless you define custom failure categories in a categories.json file. Allure doesn't create this by default.

  • Create categories.json in your allure-results directory with a structure like this (adjust to your needs):
    [
      {
        "name": "Critical Failures",
        "matchedStatuses": ["FAILED"],
        "messageRegex": ".*critical.*"
      },
      {
        "name": "Flaky Tests",
        "matchedStatuses": ["BROKEN", "PASSED"]
      },
      {
        "name": "Minor Issues",
        "matchedStatuses": ["SKIPPED"]
      }
    ]
    
  • Re-run your tests and regenerate the report — the Categories Trend chart should now show up with your defined categories.

4. Verify Widget JSON Integrity

Even if the JSON files exist in allure-reports/widgets, they might be empty or incomplete:

  • Open trend.json — it should contain an array of objects with data from multiple test runs. If it only has one entry, the Trend section will stay blank.
  • Check categories.json in the widgets folder — if it's empty, that means Allure didn't detect any matching categories (double-check your categories.json in allure-results).

5. Clean and Re-Generate the Report

Old report cache can sometimes cause display issues. Start fresh with these steps:

# Delete existing results and report
rm -rf allure-results allure-report
# Re-run tests to generate fresh results
behave -f allure_behave.formatter:AllureFormatter -o allure-results
# Generate report with clean flag to remove cache
allure generate allure-results -o allure-report --clean

Most of the time, the missing charts boil down to missing history data, missing category config, or version mismatches. Work through these steps and you should see the charts populate correctly.

内容的提问来源于stack exchange,提问作者Jake

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 10:30:36