Skip to content

HPCC4J-795 TestGenerator Full Service and Automation improvements - #981

Open
jpmcmu wants to merge 3 commits into
hpcc-systems:candidate-10.0.xfrom
jpmcmu:TestGeneratorFullService
Open

HPCC4J-795 TestGenerator Full Service and Automation improvements#981
jpmcmu wants to merge 3 commits into
hpcc-systems:candidate-10.0.xfrom
jpmcmu:TestGeneratorFullService

Conversation

@jpmcmu

@jpmcmu jpmcmu commented Mar 23, 2026

Copy link
Copy Markdown
Contributor
  • Added support for full service test generation
  • Added intial support for a Github workflow to generate tests
  • Various improvements

Signed-off-by: James McMullan James.McMullan@lexisnexis.com

Type of change:

  • This change is a bug fix (non-breaking change which fixes an issue).
  • This change is a new feature (non-breaking change which adds functionality).
  • This change is a breaking change (fix or feature that will cause existing behavior to change).

Custom Platform Testing (Optional)

Custom HPCC-Platform Repository:
repository:

Custom HPCC-Platform Branch:
branch:

Checklist:

  • I have created a corresponding JIRA ticket for this submission
  • My code follows the code style of this project.
    • I have applied the Eclipse code-format template provided.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly, or...
    • I have created a JIRA ticket to update the documentation.
    • Any new interfaces or exported functions are appropriately commented.
  • I have read the HPCC Systems CONTRIBUTORS document (https://github.com/hpcc-systems/HPCC-Platform/wiki/Guide-for-contributors).
  • The change has been fully tested:
    • This change does not cause any existing JUnits to fail.
    • I have include JUnit coverage to test this change
    • I have performed system test and covered possible regressions and side effects.
  • I have given due consideration to all of the following potential concerns:
    • Scalability
    • Performance
    • Security
    • Thread-safety
    • Premature optimization
    • This change fixes the problem, not just the symptom

Testing:

- Added support for full service test generation
- Added intial support for a Github workflow to generate tests
- Various improvements

Signed-off-by: James McMullan James.McMullan@lexisnexis.com
@github-actions

Copy link
Copy Markdown

Jira Issue: https://hpccsystems.atlassian.net/browse/HPCC4J-795

Jirabot Action Result:
Workflow Transition To: Merge Pending
Updated PR

@github-actions

Copy link
Copy Markdown

🔄 Upmerge Test Results

Status: ✅ All branches merged successfully
PR: #981 - HPCC4J-795 TestGenerator Full Service and Automation improvements
Base Branch: candidate-10.0.x
Test Time: 2026-03-23 13:19:25 UTC

✅ Successful Branches (3)

  • candidate-10.0.x
  • candidate-10.2.x
  • master
    This comment was automatically generated by the upmerge test workflow.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the scripts/wsclient-test-generator tooling to support “full-service” test generation (discovering and generating tests for all business methods in a service), adds multi-environment execution and reporting capabilities, and introduces new JUnit @Category marker interfaces for structured test categorization in HPCC4J.

Changes:

  • Add full-service orchestration to TestGeneratorAgent.py (Step 0 discovery → per-method analysis/generation → metadata aggregation), plus CI-safe operation and optional Copilot model selection.
  • Introduce environment configuration/filtering, parallel test execution support, and new/expanded prompt templates (including aggregate reporting and per-issue ticket generation).
  • Add new test category marker interfaces (CFT/ECT/EHT/CNT) under commons-hpcc.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
scripts/wsclient-test-generator/environments.example.json Adds example schema for multi-environment connection configuration.
scripts/wsclient-test-generator/UnverifiedServerIssuesReportPrompt.md Expands reporting instructions and adds per-issue ticket file generation guidance.
scripts/wsclient-test-generator/TestGeneratorAgent.py Implements full-service mode, CI mode, env config/filtering, parallel execution, and report aggregation support.
scripts/wsclient-test-generator/TestGenerationPrompt.md Updates generation prompt to require labels/categories and environmentRequirements metadata, plus dataset-generation guidance.
scripts/wsclient-test-generator/ServiceAnalysisPrompt.md New prompt to discover business methods and emit a machine-readable ordered method list.
scripts/wsclient-test-generator/README.md Documents new modes/options, environment filtering, parallelism, and outputs.
scripts/wsclient-test-generator/MethodAnalysisPrompt.md Adds CNT category guidance, file-search strategy, and scenario injection.
scripts/wsclient-test-generator/FullServiceModePlan.md Design/plan document describing full-service mode workflow and risks.
scripts/wsclient-test-generator/FixTestCompilationPrompt.md Expands compilation-fix prompt with file-search + safer edit strategies.
scripts/wsclient-test-generator/FinalReportPrompt.md Expands final report requirements (labels, env matrix, server/client issue sections).
scripts/wsclient-test-generator/BatchFailureAnalysisPrompt.md Expands failure triage instructions, adds dataset remediation guidance.
scripts/wsclient-test-generator/AggregateReportPrompt.md New prompt to generate cross-environment aggregate reports.
commons-hpcc/src/main/java/org/hpccsystems/commons/annotations/CoreFunctionalityTests.java Adds @Category marker for CFT tests (extends RemoteTests).
commons-hpcc/src/main/java/org/hpccsystems/commons/annotations/EdgeCaseTests.java Adds @Category marker for ECT tests (extends RemoteTests).
commons-hpcc/src/main/java/org/hpccsystems/commons/annotations/ErrorHandlingTests.java Adds @Category marker for EHT tests (extends RemoteTests).
commons-hpcc/src/main/java/org/hpccsystems/commons/annotations/ConnectivityTests.java Adds @Category marker for CNT tests (extends RemoteTests).
.github/workflows/test-generator.yml Adds a manual GitHub Actions workflow to generate/build and run tests across containerized/baremetal/secure envs.
.github/actions/setup-copilot-cli/action.yml Exports GH_TOKEN to the job environment for subsequent steps’ Copilot CLI auth.

Comment thread scripts/wsclient-test-generator/TestGeneratorAgent.py
Comment thread .github/workflows/test-generator.yml Outdated
Comment thread .github/workflows/test-generator.yml
Comment thread scripts/wsclient-test-generator/README.md Outdated
Comment thread scripts/wsclient-test-generator/TestGeneratorAgent.py Outdated
Comment thread scripts/wsclient-test-generator/TestGeneratorAgent.py Outdated
@jpmcmu
jpmcmu marked this pull request as ready for review April 7, 2026 13:08
@jpmcmu
jpmcmu requested a review from rpastrana April 7, 2026 13:12
@jpmcmu
jpmcmu requested a review from Copilot April 8, 2026 13:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 11 comments.

Comment on lines +1244 to +1252
# Run tests — parallel or sequential depending on PARALLEL_THREADS
print(f"\n🧪 Running {len(tests_to_execute)} test(s)" +
(f" (up to {PARALLEL_THREADS} in parallel)..." if PARALLEL_THREADS > 1 else " sequentially..."))
test_results = run_tests_parallel(
tests_to_execute, test_class,
hpcc_conn, wssql_conn, hpcc_user, hpcc_pass,
disable_dataset_generation=disable_dataset_generation,
num_threads=PARALLEL_THREADS,
)

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

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

Line 1244 is aligned at column 0 while the following statements remain indented as if they’re inside the while iteration < ... loop. This will trigger an IndentationError (indented block with no enclosing statement). Indent line 1244 to match the rest of the loop body (or unindent 1245–1252) so the block structure is syntactically valid.

Copilot uses AI. Check for mistakes.
List of result dicts in the same order as *tests_to_execute*, each
containing ``{"metadata": <test_info>, "result": <run_individual_test result>}``.
"""
ordered_results: List[Dict[str, Any]] = [None] * len(tests_to_execute) # type: ignore[list-item]

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

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

The declared type is List[Dict[str, Any]] but the list is initialized with None elements. This forces a type: ignore that defeats the benefit of the type hints. Use List[Optional[Dict[str, Any]]] (and drop the ignore), or initialize with an empty list and append results while preserving ordering another way.

Suggested change
ordered_results: List[Dict[str, Any]] = [None] * len(tests_to_execute) # type: ignore[list-item]
ordered_results: List[Optional[Dict[str, Any]]] = [None] * len(tests_to_execute)

Copilot uses AI. Check for mistakes.
Also adds directory context for HPCC4J, HPCC Platform, and tmp directories.
"""
cmd = ["copilot", "-p", prompt_text]
cmd = ["copilot", "-p", prompt_text, "--no-ask-user"]

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

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

build_copilot_cmd() now forces --no-ask-user, but copilot_generate() still prints that Copilot will run interactively and prompts users to review/save output. These conflict and will confuse users (especially in CI). Update the messaging to reflect non-interactive execution, or only add --no-ask-user when --ci is set.

Suggested change
cmd = ["copilot", "-p", prompt_text, "--no-ask-user"]
cmd = ["copilot", "-p", prompt_text]
# Only force non-interactive execution in CI mode so local runs can
# remain consistent with interactive user messaging elsewhere.
ci_mode = bool(getattr(args, "ci", False) or os.environ.get("CI"))
if ci_mode:
cmd.append("--no-ask-user")

Copilot uses AI. Check for mistakes.
@@ -351,24 +520,31 @@ def copilot_generate(prompt_file, output_file, variables=None):
print("Note: This will run Copilot interactively. Please review the analysis and ensure it's saved to the correct file.")

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

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

build_copilot_cmd() now forces --no-ask-user, but copilot_generate() still prints that Copilot will run interactively and prompts users to review/save output. These conflict and will confuse users (especially in CI). Update the messaging to reflect non-interactive execution, or only add --no-ask-user when --ci is set.

Suggested change
print("Note: This will run Copilot interactively. Please review the analysis and ensure it's saved to the correct file.")
print("Note: Copilot will run non-interactively and is expected to create the target file automatically.")

Copilot uses AI. Check for mistakes.
| Error Handling | `EHT` | `@Category(ErrorHandlingTests.class)` | Invalid inputs, expected error responses, failure scenarios |
| Connectivity | `CNT` | `@Category(ConnectivityTests.class)` | Service reachability, authentication, endpoint validation |

--

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

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

This appears intended to be a Markdown horizontal rule, but -- won’t render as one in standard Markdown. Use --- (or remove the line) to avoid formatting breaking in rendered prompt docs.

Suggested change
--
---

Copilot uses AI. Check for mistakes.

### Current Version (November 2025)
- ✅ Four-step automated test generation
### February 2026

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

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

The changelog entries conflict: Step 0/service discovery is introduced under February 2026, but the November 2025 entry also claims Step 0 was added then. Reconcile these entries so the changelog reflects a consistent history.

Copilot uses AI. Check for mistakes.
- ✅ **Updated `TestGenerationPrompt.md`**: Accepts service analysis context for dependency-aware test generation

### November 2025
- ✅ Five-step automated test generation (Step 0 added for service discovery)

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

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

The changelog entries conflict: Step 0/service discovery is introduced under February 2026, but the November 2025 entry also claims Step 0 was added then. Reconcile these entries so the changelog reflects a consistent history.

Suggested change
-Five-step automated test generation (Step 0 added for service discovery)
-Four-step automated test generation

Copilot uses AI. Check for mistakes.
Comment on lines +50 to +54
output_dir:
description: "Path (relative to repo root) of TestGeneratorAgent output dir to load metadata from. Leave blank to run all tests in the service's test class."
required: false
default: ""
type: string

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

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

The workflow defines an output_dir input and sets OUTPUT_DIR in the environment, but the invoked command does not pass any flag corresponding to this value, and the agent (per the shown diffs) derives OUTPUT_DIR internally rather than reading an env var. Either (a) wire this input into TestGeneratorAgent.py via a supported CLI arg, or (b) remove the input/env var to avoid a misleading no-op control.

Suggested change
output_dir:
description: "Path (relative to repo root) of TestGeneratorAgent output dir to load metadata from. Leave blank to run all tests in the service's test class."
required: false
default: ""
type: string

Copilot uses AI. Check for mistakes.
Comment on lines +213 to +216
- name: Run tests — containerized environment
if: steps.k8s_deploy.outcome == 'success'
continue-on-error: true
env:

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

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

The workflow defines an output_dir input and sets OUTPUT_DIR in the environment, but the invoked command does not pass any flag corresponding to this value, and the agent (per the shown diffs) derives OUTPUT_DIR internally rather than reading an env var. Either (a) wire this input into TestGeneratorAgent.py via a supported CLI arg, or (b) remove the input/env var to avoid a misleading no-op control.

Copilot uses AI. Check for mistakes.
SERVICE_NAME: ${{ github.event.inputs.service_name }}
METHOD_NAME: ${{ github.event.inputs.method_name }}
PARALLEL_THREADS: ${{ github.event.inputs.parallel_threads }}
OUTPUT_DIR: ${{ github.event.inputs.output_dir }}

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

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

The workflow defines an output_dir input and sets OUTPUT_DIR in the environment, but the invoked command does not pass any flag corresponding to this value, and the agent (per the shown diffs) derives OUTPUT_DIR internally rather than reading an env var. Either (a) wire this input into TestGeneratorAgent.py via a supported CLI arg, or (b) remove the input/env var to avoid a misleading no-op control.

Suggested change
OUTPUT_DIR: ${{ github.event.inputs.output_dir }}

Copilot uses AI. Check for mistakes.
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.

2 participants