Skip to content

Support test descriptions (e.g. hint on hover over a test) #60

Description

@roxblnfk

Summary

Add support for test descriptions in the plugin. A test's description should be surfaced in the IDE — for example as a hint shown when hovering the cursor over a test (in the editor gutter, the test method name, or the test tree).

Background

In Testo, a test's description originates from the summary part of the test method's PHPDoc — the text before the first block annotation (a line starting with @).

Example:

#[Test]
final class WidgetTest
{
    /**
     * Verifies the widget renders correctly.
     */
    public function renders(): void { /* ... */ }
}

Here the description of renders is Verifies the widget renders correctly.

Important

The description is not simply the PHPDoc text. It is computed at runtime and can be modified during the Testo pipeline (interceptors/plugins may rewrite it). This logic cannot be reproduced in the IDE plugin, so the plugin must not parse PHPDoc via PSI to derive it — it has to take the final value from the test runner.

Where the description comes from

The authoritative source is the runtime value emitted by the test runner. When running with --teamcity, Testo emits the description on testStarted as the metainfo attribute:

##teamcity[testStarted name='renders' locationHint='...' metainfo='Verifies the widget renders correctly.']

The plugin should read the description from this metainfo attribute.

Proposed UX

  • Surface the description in the test run tree (it arrives with testStarted).
  • Optionally show it as a hover tooltip over the corresponding test method / #[Test] element, using the value captured from the last run.

Notes

  • Multi-line descriptions are possible (the PHPDoc summary may span several lines); metainfo is escaped per the TeamCity service-message rules (|n for newlines, etc.).
  • The description may be empty (e.g. PHPDoc with only annotations) — in that case the metainfo attribute is omitted, and nothing should be shown.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions