HPCC4J-795 TestGenerator Full Service and Automation improvements - #981
HPCC4J-795 TestGenerator Full Service and Automation improvements#981jpmcmu wants to merge 3 commits into
Conversation
- 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
|
Jira Issue: https://hpccsystems.atlassian.net/browse/HPCC4J-795 Jirabot Action Result: |
🔄 Upmerge Test ResultsStatus: ✅ All branches merged successfully ✅ Successful Branches (3)
|
There was a problem hiding this comment.
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) undercommons-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. |
| # 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, | ||
| ) |
There was a problem hiding this comment.
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.
| 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] |
There was a problem hiding this comment.
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.
| 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) |
| Also adds directory context for HPCC4J, HPCC Platform, and tmp directories. | ||
| """ | ||
| cmd = ["copilot", "-p", prompt_text] | ||
| cmd = ["copilot", "-p", prompt_text, "--no-ask-user"] |
There was a problem hiding this comment.
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.
| 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") |
| @@ -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.") | |||
There was a problem hiding this comment.
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.
| 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.") |
| | Error Handling | `EHT` | `@Category(ErrorHandlingTests.class)` | Invalid inputs, expected error responses, failure scenarios | | ||
| | Connectivity | `CNT` | `@Category(ConnectivityTests.class)` | Service reachability, authentication, endpoint validation | | ||
|
|
||
| -- |
There was a problem hiding this comment.
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.
| -- | |
| --- |
|
|
||
| ### Current Version (November 2025) | ||
| - ✅ Four-step automated test generation | ||
| ### February 2026 |
There was a problem hiding this comment.
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.
| - ✅ **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) |
There was a problem hiding this comment.
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.
| - ✅ Five-step automated test generation (Step 0 added for service discovery) | |
| - ✅ Four-step automated test generation |
| 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 |
There was a problem hiding this comment.
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.
| 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 |
| - name: Run tests — containerized environment | ||
| if: steps.k8s_deploy.outcome == 'success' | ||
| continue-on-error: true | ||
| env: |
There was a problem hiding this comment.
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.
| 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 }} |
There was a problem hiding this comment.
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.
| OUTPUT_DIR: ${{ github.event.inputs.output_dir }} |
Signed-off-by: James McMullan James.McMullan@lexisnexis.com
Type of change:
Custom Platform Testing (Optional)
Custom HPCC-Platform Repository:
repository:
Custom HPCC-Platform Branch:
branch:
Checklist:
Testing: