Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement- add skip count, total and passing % to karate summary HTML report #2340

Closed
rc2201 opened this issue Jun 12, 2023 · 19 comments
Closed
Assignees
Labels

Comments

@rc2201
Copy link

rc2201 commented Jun 12, 2023

We are using karate.abort() extensively in our project to control the execution of scenarios depending upon the test data pre-requirement, environment limitations etc. Along with this,our runner executes multiple feature files.

Below enhancement to karate summary report would greatly improve our experience with the reporting-

  1. Adding the count of skipped scenario.
  2. In case of multiple feature files being executed, adding total# to provide total of passed / failed / skipped scenarios. This is already provided on the console.
  3. % of passing scenarios.

Attaching the screenshot for refrence.

Karate HTML report

Hopefully, other karate users will also find these features useful as well.

@Jasmine-maryj
Copy link

I'd like to work on this!

@ptrthomas
Copy link
Member

@Jasmine-maryj sure go ahead, here is the Hacktoberfest process we follow: https://github.com/karatelabs/karate/wiki/Hacktoberfest

@ptrthomas
Copy link
Member

some more requests to consider: https://stackoverflow.com/q/77664133/143475

@Mike-c-Jackson
Copy link

Thanks Peter, I think these would be helpful additions

@codehackerr
Copy link
Contributor

codehackerr commented Jan 11, 2024

@ptrthomas this is open for a while. I would like to work on this.

@ptrthomas
Copy link
Member

@codehackerr sure, please proceed with a PR

@codehackerr
Copy link
Contributor

@ptrthomas

Approach to fixing this issue:

  1. Adding Skipped Count: Whenever a scenario is skipped in ScenarioRuntime, skippedCount variable is incremented on FeatureResult. This is later used in the feature-summary report.

  2. Change to Totals calculation on a Feature:

  • As of now Scenario Total = Scenario Success + Scenario Failed.
  • With the introduction of Skipped Scenarios, new way to calculate total is Scenario Total = Scenario Success + Scenario Failed + Scenario Skipped.
  • Existing Scenario Total will be refactored to Scenario Run Total, such that Scenario Run Total = Scenario Success + Scenario Failed
  1. Totals Row: Will use Results class and add skippedScenarios to this. Will add a totals row in feature-summary.html
  2. Percentage Calculations:
    Row: ( Passed Scenarios Feature / Total Scenarios In Feature) * 100 - Rounded to whole number
    Total: ( Passed Scenarios across All Features / Total Scenarios across all Features) * 100 - Rounded to whole number

Proposed Summary Report Screenshot:

Karate-report-screenshot

Kindly review and suggest any modifications. If approach is okay, I can push a PR soon. Thanks!

@codehackerr
Copy link
Contributor

I am getting a 403 on branch push.
Permission to karatelabs/karate.git denied to codehackerr.
I am able to push to other repos, so authentication is okay.
Is there any access grants required ?

@ptrthomas
Copy link
Member

@codehackerr please refer to the typical PR process: https://github.com/karatelabs/karate/blob/master/.github/CONTRIBUTING.md

@shassankani
Copy link

I am also waiting for the Karate summary report enhancement, for a while. Good to see progress on this issue. When will this be released?

@Mike-c-Jackson
Copy link

Mike-c-Jackson commented Jan 16, 2024 via email

@codehackerr
Copy link
Contributor

@Mike-c-Jackson From what I understand, not in the scope of this issue. Could you link me to existing feature requests/issues or create one with the details?

@Mike-c-Jackson
Copy link

This was mentioned in the linked post that @ptrthomas added on Dev 14th. That is the 4th post in this chain

@ptrthomas
Copy link
Member

this has been merged to develop

@rc2201
Copy link
Author

rc2201 commented Feb 2, 2024

I tested the changes. changes for pass % and total are working fine. But i was not able to verify skipped scenario count. Here is the use case which was tried and mentioned-

  1. Exited the scenarios / features using the karate.abort() function.
  2. But those scenario are still being counted as passed in the report.

Even though it should not matter, i have tried with abortedStepsShouldPass value as true and false.

@codehackerr what was the criteria to count a scenario as skipped?

@ptrthomas
Copy link
Member

@rc2201 - please if this is is not resolved soon, we will be undo-ing all related changes, no other team has requested this. I don't think karate.abort() should be used extensively. anyone is welcome to open a new discussion to discuss if any fundamental changes need to be made to karate.

trying to put conditional logic in tests is an anti-pattern, but I'm open to exploring if testing of complex business-rules can be made easier - but I'd like to understand the context first

@ptrthomas
Copy link
Member

all: to be clear why we are considering to undo all related changes is because we have a report of breaking changes to existing users of karate, refer: #2477 (comment)

especially as this is a cosmetic request and not something we see many teams ask for - we'll play it safe and undo these changes. anyone is welcome to submit a PR to fix this and get confirmation that there are no breaking changes to existing users - but I don't consider this a priority

@rc2201
Copy link
Author

rc2201 commented Feb 8, 2024

@ptrthomas i send an email to you with context around this enhancement request.

@ptrthomas
Copy link
Member

changes have been reverted, closing as wontfix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants