Skip to content

Add comprehensive test suite and improve run configuration UI#47

Open
xepozz wants to merge 20 commits intomainfrom
claude/create-claude-md-docs-TbEpZ
Open

Add comprehensive test suite and improve run configuration UI#47
xepozz wants to merge 20 commits intomainfrom
claude/create-claude-md-docs-TbEpZ

Conversation

@xepozz
Copy link
Contributor

@xepozz xepozz commented Mar 17, 2026

Summary

This PR adds extensive unit test coverage for the Testo plugin and enhances the run configuration editor with a full UI for managing Testo-specific options.

Key Changes

Test Coverage

  • New test classes covering core functionality:

    • MixinPsiTest: Tests for PSI extension functions (isTestoClass(), isTestoMethod(), isTestoDataProviderLike())
    • TestoRunConfigurationHandlerTest: Tests for run configuration argument parsing and preparation
    • TestoDataProvidersIndexTest: Tests for data provider index serialization/deserialization
    • TestoRunnerSettingsTest: Tests for runner settings initialization and conversion
    • ExitStatementsVisitorTest: Tests for yield/return statement counting
    • TestoLineMarkerPsiTest: Tests for location hint generation
    • TestoTestLocatorTest: Tests for stack trace location parsing
    • TestoFrameworkTypeTest: Tests for framework type constants
    • TestoTestDescriptorTest: Tests for test class name detection
    • TestoClassesTest: Tests for attribute constant definitions
    • MixinExtensionsTest: Tests for sequence extension functions
    • PsiUtilTest: Tests for meaningful attributes collection
    • TestoLineMarkerCompanionTest: Tests for runnable attributes
    • TestoVersionDetectorTest: Tests for version string parsing
    • MyPluginTest: Updated existing test
  • Test data files (PHP fixtures):

    • TestClassWithTestSuffix.php: Test class with "Test" suffix
    • TestClassWithTestBaseSuffix.php: Test class with "TestBase" suffix
    • RegularClass.php: Non-test class for negative cases
    • TestClassWithAttributes.php: Class with Testo attributes
    • DataProviderClass.php: Class with data provider methods

Run Configuration UI

  • Enhanced TestoTestRunConfigurationEditor: Added comprehensive UI panel with:
    • Command field (ComboBox with "run" default)
    • Suite field (text input for --suite)
    • Group field (text input for --group)
    • Exclude group field (text input for --exclude-group)
    • Repeat field (spinner for --repeat, 0-10000)
    • Parallel field (spinner for --parallel, 0-64)
    • Proper layout with labels, gaps, and row comments

Core Improvements

  • TestoRunConfigurationHandler: Added prepareArguments() method to build CLI arguments from settings
  • TestoRunnerSettings: Added XML serialization attributes and new fields:
    • command: Subcommand to execute (default: "run")
    • suite: Test suite name
    • group: Test group filter
    • excludeGroup: Excluded group filter
    • repeat: Repeat count
    • parallel: Parallel execution count
    • testoType: Test type (bench/test/inline)
  • TestoRunConfiguration: Updated to use new handler and settings
  • TestoClasses: Simplified attribute constants (removed version-specific variants)
  • TestoRunConfigurationProducer: Enhanced with additional imports and logic for configuration creation
  • Live templates: Added "bench" template for benchmark methods
  • File template: Updated to use simplified Testo\Test import

Notable Implementation Details

  • Tests use BasePlatformTestCase for PSI-based tests with proper fixture configuration
  • Serialization tests verify round-trip data integrity for index externalizers
  • UI components follow IntelliJ DSL builder pattern with proper layout and accessibility
  • Settings properly annotated with @Tag, @Attribute, @Property for XML persistence
  • Comprehensive test data fixtures enable realistic PSI tree testing

https://claude.ai/code/session_01TmFvjfMtoxTvddQRBzsbPN

claude and others added 20 commits March 17, 2026 08:40
Describes architecture, tech stack, build commands, project structure,
Testo PHP framework integration details, constraints, and CI/CD setup.

https://claude.ai/code/session_01TmFvjfMtoxTvddQRBzsbPN
Matches refactor from 75a5fcc: attributes are now organized into
TEST_ATTRIBUTES, TEST_INLINE_ATTRIBUTES, DATA_ATTRIBUTES, BENCH_ATTRIBUTES
arrays and spread across the codebase instead of being duplicated.

https://claude.ai/code/session_01TmFvjfMtoxTvddQRBzsbPN
Tests cover:
- TestoClasses: attribute arrays content, no overlaps, constants
- TestoTestDescriptor: isTestClassName logic
- TestoVersionDetector: version parsing, error handling
- TestoFrameworkType: constants, ID, composer packages
- TestoRunnerSettings: defaults, custom values, fromPhpTestRunnerSettings
- TestoRunConfigurationHandler: config file option, singleton
- MixinExtensions: takeWhileInclusive for sequences and collections
- LineMarkerCompanion: RUNNABLE_ATTRIBUTES composition
- PsiUtil: MEANINGFUL_ATTRIBUTES composition, no duplicates

https://claude.ai/code/session_01TmFvjfMtoxTvddQRBzsbPN
Based on IntelliJ Platform SDK testing guidelines:
- MixinPsiTest: 17 tests for isTestoClass, isTestoMethod, isTestoFile,
  isTestoExecutable, isTestoDataProviderLike using configureByText with PHP PSI
- ExitStatementsVisitorTest: 5 tests for yield/return counting in PHP functions
- TestoLineMarkerPsiTest: 6 tests for location hint generation (class, method,
  file, data provider, inline test hints)
- TestoTestLocatorTest: 6 tests for getLocationInfo URL parsing
- TestoDataProvidersIndexTest: 8 tests for DataProviderUsage record,
  externalizer serialization round-trips, index metadata
- Fix MyPluginTest: remove reference to non-existent MyProjectService
- Add PHP testData files for mixin tests

https://claude.ai/code/session_01TmFvjfMtoxTvddQRBzsbPN
Based on infection-plugin architecture:

- TestoRunnerSettings: add @Tag/@Attribute annotations for XMLB serialization,
  new fields: command, suite, group, excludeGroup, repeat, parallel.
  fromPhpTestRunnerSettings() now copies Testo-specific fields.

- TestoRunConfigurationHandler: add prepareArguments() that builds argument list
  from settings (suite, group, excludeGroup, repeat, parallel). Overloaded
  prepareCommand() supports custom subcommand. Extract parseMethodName() for
  method#dataProvider parsing.

- TestoRunConfiguration: override createCommand() to take full control of
  command assembly. Extract fillTestRunnerArguments() for scope-based args
  (Type, Directory, File, Method, ConfigurationFile).

- TestoRunConfigurationSettings: add @Property/@transient for proper XMLB
  serialization of TestoRunnerSettings.

- TestoTestRunConfigurationEditor: add UI fields for command, suite, group,
  excludeGroup, repeat, parallel with proper reset/apply binding and
  reflection-based parent editor integration.

- Tests: full coverage for prepareArguments(), parseMethodName(),
  fromPhpTestRunnerSettings() with new fields.

https://claude.ai/code/session_01TmFvjfMtoxTvddQRBzsbPN
- Add \Testo\Bench\Bench constant to TestoClasses and BENCH_ATTRIBUTES
  so #[Bench] attribute gets a gutter run icon via RUNNABLE_ATTRIBUTES

- Set selectedType="bench" in TestoRunConfigurationProducer when the
  element being configured is a bench method (isTestoBench())

- Add --type argument to prepareArguments() based on selectedType,
  so benchmark runs pass --type bench to the CLI

- Tests: update BENCH_ATTRIBUTES count, add --type bench tests,
  add order verification, add explicit Bench constant check

https://claude.ai/code/session_01TmFvjfMtoxTvddQRBzsbPN
selectedType is a PhpTestRunnerSettings field tied to Scope.Type,
which breaks normal test/method run configurations. Use our own
testoType attribute in TestoRunnerSettings instead.

https://claude.ai/code/session_01TmFvjfMtoxTvddQRBzsbPN
Resolve testoType from the specific attribute FQN:
- #[Test], #[Data*] → --type=test
- #[TestInline] → --type=inline
- #[Bench] → --type=bench

https://claude.ai/code/session_01TmFvjfMtoxTvddQRBzsbPN
- TestoRunConfigurationHandlerTest: verify --type=test, --type=inline,
  --type=bench flags, and no --type when testoType is empty/default
- TestoRunnerSettingsTest: cover testoType in defaults, custom values,
  and fromPhpTestRunnerSettings copy

https://claude.ai/code/session_01TmFvjfMtoxTvddQRBzsbPN
Detect \Testo\Application\Config\ApplicationConfig class references
and show a play button in the gutter. Clicking it creates a run
configuration with --config=<file-path> using the existing
Scope.ConfigurationFile mechanism.

https://claude.ai/code/session_01TmFvjfMtoxTvddQRBzsbPN
- Restrict line marker and producer to ClassReference inside
  NewExpression (not use/import statements)
- Add isTestoConfigFile() to mixin.kt for detecting config files
- Include config files in isTestoFile() so right-click Run works
- Handle PhpFile config in setupConfiguration with --config flag

https://claude.ai/code/session_01TmFvjfMtoxTvddQRBzsbPN
- Add SUITE_CONFIG constant for \Testo\Application\Config\SuiteConfig
- Add line marker on `new SuiteConfig(...)` for per-suite run
- Extract suite name from first constructor parameter
- Run config sets --suite=<name> and --config=<file> flags
- Match existing SuiteConfig configs in isConfigurationFromContext

https://claude.ai/code/session_01TmFvjfMtoxTvddQRBzsbPN
@github-actions
Copy link

Qodana Community for JVM

6 new problems were found

Inspection name Severity Problems
Class member can have 'private' visibility ◽️ Notice 6

💡 Qodana analysis was run in the pull request mode: only the changed files were checked

View the detailed Qodana report

To be able to view the detailed Qodana report, you can either:

To get *.log files or any other Qodana artifacts, run the action with upload-result option set to true,
so that the action will upload the files as the job artifacts:

      - name: 'Qodana Scan'
        uses: JetBrains/qodana-action@v2025.3.1
        with:
          upload-result: true
Contact Qodana team

Contact us at qodana-support@jetbrains.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants