Skip to content

Conversation

mpkorstanje
Copy link
Contributor

@mpkorstanje mpkorstanje commented Oct 2, 2025

🤔 What's changed?

Use a message based usage formatter.

The --plugin usage now produces a human readable report where for each step definition usage statistics are calculated. Individual durations for each step are also included.

Expression/Text                           Duration   Mean ±  Error Location                                                          
I have {int} cukes in my belly              0.002s 0.002s ± 0.000s io.cucumber.skeleton.StepDefinitions.I_have_cukes_in_my_belly(int)
  I have 42 cukes in my belly               0.002s                 src/test/resources/io/cucumber/skeleton/belly.feature:3           
a forgotten step, unused, but not unloved                          io.cucumber.skeleton.StepDefinitions.an_unused_step()             
  UNUSED                                                                                                                             

With this implementation any unused step definitions also automatically show up in the report as step definitions without steps. This also allow the report to be reused for the unused steps formatter.

1 unused step definition(s)

Location                                              Expression                                 
io.cucumber.skeleton.StepDefinitions.an_unused_step() # a forgotten step, unused, but not unloved

A --plugin usage-json was added to provide a json based report. This reports structure differs significantly from the original json output from the usage plugin.

⚡️ What's your motivation?

🏷️ What kind of change is this?

  • 🏦 Refactoring/debt/DX (improvement to code design, tooling, etc. without changing behaviour)
  • ⚡ New feature (non-breaking change which adds new behaviour)
  • 💥 Breaking change (incompatible changes to the API)

♻️ Anything particular you want feedback on?

Previously the output would calculate the average and median duration for each pickle step.

[
  {
    "source": "I have {int} cukes in my belly",
    "steps": [
      {
        "name": "I have 42 cukes in my belly",
        "aggregatedDurations": {
          "median": 0.002683112,
          "average": 0.002683112
        }
      }
    ]
  }
]

This is only useful if the same pickle step rather than the same step definition is used repeatedly - and presumably that doesn't happen too much. Looking at #214 I also can't work out what the rationale for this structure is supposed to be.

Further more, we don't have any sort of analytics as to whether this is formatter is used at all. So I'm completely in the dark here. If you did find this old useful and the new usage-json formatter does not work for you, please create a new issue and explain why.

📋 Checklist:

Reworks the usage formatter to be useful too. Does change the json
structure significantly.
@mpkorstanje mpkorstanje mentioned this pull request Oct 2, 2025
11 tasks
@mpkorstanje mpkorstanje marked this pull request as ready for review October 15, 2025 16:05
@mpkorstanje mpkorstanje merged commit 6476597 into main Oct 15, 2025
6 checks passed
@mpkorstanje mpkorstanje deleted the message-based-usage-formatter branch October 15, 2025 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant