Skip to content

Shared suites for Maven/Gradle Tests#609

Merged
sharma1208 merged 5 commits into
OpenLiberty:mainfrom
sharma1208:shared-restsnippet-suite
Jun 29, 2026
Merged

Shared suites for Maven/Gradle Tests#609
sharma1208 merged 5 commits into
OpenLiberty:mainfrom
sharma1208:shared-restsnippet-suite

Conversation

@sharma1208

Copy link
Copy Markdown
Contributor

Builds on #606
Fixes #607

Summary

After the POM refactor (#606), Maven and Gradle test files were nearly identical except for build-tool-specific data (project paths, parameter formats, report locations). This PR collapses each test pair into shared parameterized suites, eliminating ~50% of test code duplication.

Changes

Created 3 Shared Test Suites (src/test/shared/)

  1. restSnippetSuite.ts

    • Parameterized REST snippet and diagnostic tests
    • Config: { buildTool, getProjectPath }
    • Eliminates ~200 lines of duplication per build tool
  2. hoverTestSuite.ts

    • Parameterized hover tests
    • Config: { buildTool, getProjectPath, hoverTestCases }
    • Handles build-tool-specific line numbers (server.xml differences)
    • Eliminates ~150 lines of duplication per build tool
  3. devModeTestSuite.ts

    • 6 shared DevMode tests: Find sidebar, Show items, Start, Start with Docker, Run tests, Attach debugger
    • Config: { buildTool, getProjectPath, projectConstant, testRunString }
    • Maven/Gradle-specific tests remain in separate describe blocks

Refactored Entry Files

Each Maven/Gradle entry file now:

  • Calls the shared suite with build-tool-specific config (~4 lines)
  • Keeps build-tool-specific tests in separate describe blocks (where needed)

mattbsox
mattbsox previously approved these changes Jun 24, 2026
- Created shared/restSnippetSuite.ts for REST snippet tests
- Created shared/hoverTestSuite.ts for hover tests
- Created shared/devModeTestSuite.ts for DevMode tests (6 shared tests)
- Refactored Maven/Gradle entry files to use shared suites
- Achieved ~50% code reduction through parameterization
- Kept build-tool-specific tests in separate describe blocks
@sharma1208

Copy link
Copy Markdown
Contributor Author

force rebase due to changes on POM refactoring moving methods to editorUtils.ts #606

@mattbsox mattbsox left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but I think we'll need to refactor the Gradle 9 test too.

@sharma1208 sharma1208 requested a review from mattbsox June 26, 2026 21:27
Comment thread src/test/Gradle9TestDevModeActions.ts Outdated
@sharma1208 sharma1208 merged commit 11441de into OpenLiberty:main Jun 29, 2026
0 of 8 checks passed
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.

Reduce Maven/Gradle test duplication via shared suites

2 participants