serenity-bdd / serenity-maven-plugin

19 stars 21 forks source link

Maybe incorrect statistics on the report chart #85

Open yunwu-cn opened 2 years ago

yunwu-cn commented 2 years ago

Hi I was using cucumber-serenity for some tests, it runs great with awesome report view. However, when I select some tags, the stats seem incorrect on the overview piechart.

Here's the screenshot of my report, when I select tag: Dev. There should be only 2 tests. But the Test Outcomes showed 4, and the Overview piechart center has 200%, which will confuse people. image

Here's how the feature file looks like:

Feature: some feature name

  Scenario Outline: Positive Test 
    Given ***
    When ***
    Then ***

    @dev
    Examples:
     | username  | password  |
     | user1     | password1 |

    @qa
    Examples:
     | username  | password  |
     | user2     | password2 |

  Scenario Outline: Negative Test 
    Given ***
    When ***
    Then ***

    @dev
    Examples:
     | username  | password  |
     | user3     | password3 |

    @qa
    Examples:
     | username  | password  |
     | user4     | password4 |

When run the test, I do mvn verify -Dcucumber.filter.tags="@dev or @qa"

wakaleo commented 2 years ago

Yeah, the percentage looks wrong. The number of test outcomes will include rows of test data, which may be why the test outcomes is reporting 4. Can you provide a sample project to reproduce the issue?

yunwu-cn commented 2 years ago

Thank you for such a quick reply. I will provide a sample project tomorrow here.

Yeah, the percentage looks wrong. The number of test outcomes will include rows of test data, which may be why the test outcomes is reporting 4. Can you provide a sample project to reproduce the issue?

wakaleo commented 2 years ago

If you want to take a look at the code yourself, the graph uses jscharts and is in the result-chart.ftl file - it could be a simple fix.

yunwu-cn commented 2 years ago

Will take a look tomorrow if I get time. Thank you.

If you want to take a look at the code yourself, the graph uses jscharts and is in the result-chart.ftl file - it could be a simple fix.

yunwu-cn commented 2 years ago

@wakaleo I haven't got time to dive too deep. But it looks like the ResultCounts that passed into the page, the counts are only filtered by Result, not tag. Here's my sample project that can be used to reproduce the issue: https://github.com/yunwu-cn/sample-serenity-report-issue

Just run mvn verify to generate the HTML report. And go to the bottom of the report, click one of the tags, you will see the incorrect stats near the top of the page.

wakaleo commented 2 years ago

Could you try with 3.2.0?

yunwu-cn commented 2 years ago

tried with 3.2.0, still see the same issue. ps, above sample project is updated to use 3.2.0.

wakaleo commented 2 years ago

The reports with 3.2.0 seem to be as expected - what are you expecting to be displayed?

image image image
yunwu-cn commented 2 years ago

The "All Tests" summary is correct, when a specific tag is selected, the stats are incorrect.