nat-engine 1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mannf/__init__.py +33 -0
- mannf/__main__.py +10 -0
- mannf/_version.py +8 -0
- mannf/agents/__init__.py +7 -0
- mannf/agents/analyzer_agent.py +9 -0
- mannf/agents/base.py +9 -0
- mannf/agents/bdi_agent.py +9 -0
- mannf/agents/belief_state.py +9 -0
- mannf/agents/coordinator_agent.py +9 -0
- mannf/agents/executor_agent.py +9 -0
- mannf/agents/monitor_agent.py +9 -0
- mannf/agents/oracle_agent.py +9 -0
- mannf/agents/planner_agent.py +9 -0
- mannf/agents/test_agent.py +9 -0
- mannf/anomaly/__init__.py +7 -0
- mannf/anomaly/enhanced_detector.py +9 -0
- mannf/cli.py +9 -0
- mannf/core/__init__.py +26 -0
- mannf/core/agents/__init__.py +52 -0
- mannf/core/agents/accessibility_scanner_agent.py +245 -0
- mannf/core/agents/analyzer_agent.py +224 -0
- mannf/core/agents/autonomous_loop_agent.py +1086 -0
- mannf/core/agents/autonomous_loop_models.py +62 -0
- mannf/core/agents/autonomous_run_differ.py +427 -0
- mannf/core/agents/base.py +128 -0
- mannf/core/agents/bdi_agent.py +330 -0
- mannf/core/agents/belief_state.py +202 -0
- mannf/core/agents/browser_coordinator_agent.py +224 -0
- mannf/core/agents/browser_executor_agent.py +410 -0
- mannf/core/agents/coordinator_agent.py +262 -0
- mannf/core/agents/executor_agent.py +222 -0
- mannf/core/agents/monitor_agent.py +188 -0
- mannf/core/agents/oracle_agent.py +150 -0
- mannf/core/agents/performance_testing_agent.py +279 -0
- mannf/core/agents/planner_agent.py +128 -0
- mannf/core/agents/test_agent.py +249 -0
- mannf/core/agents/visual_regression_agent.py +311 -0
- mannf/core/agents/web_crawler_agent.py +510 -0
- mannf/core/agents/worker_pool.py +366 -0
- mannf/core/anomaly/__init__.py +14 -0
- mannf/core/anomaly/enhanced_detector.py +541 -0
- mannf/core/browser/__init__.py +63 -0
- mannf/core/browser/accessibility_scanner.py +424 -0
- mannf/core/browser/discovery_model.py +178 -0
- mannf/core/browser/dom_snapshot.py +349 -0
- mannf/core/browser/ingestor_bridge.py +371 -0
- mannf/core/browser/performance_metrics.py +217 -0
- mannf/core/browser/reflection_analyzer.py +442 -0
- mannf/core/browser/scenario_generator.py +1100 -0
- mannf/core/browser/security_scenario_generator.py +695 -0
- mannf/core/browser/visual_comparer.py +159 -0
- mannf/core/diagnostics/__init__.py +28 -0
- mannf/core/diagnostics/failure_clusterer.py +211 -0
- mannf/core/diagnostics/flake_detector.py +233 -0
- mannf/core/diagnostics/root_cause_analyzer.py +273 -0
- mannf/core/distributed/__init__.py +16 -0
- mannf/core/distributed/endpoint.py +139 -0
- mannf/core/distributed/system_under_test.py +207 -0
- mannf/core/functional_orchestrator.py +428 -0
- mannf/core/messaging/__init__.py +11 -0
- mannf/core/messaging/bus.py +113 -0
- mannf/core/messaging/messages.py +89 -0
- mannf/core/nat_orchestrator.py +342 -0
- mannf/core/neural/__init__.py +183 -0
- mannf/core/orchestrator.py +272 -0
- mannf/core/prioritization/__init__.py +17 -0
- mannf/core/prioritization/adaptive_controller.py +509 -0
- mannf/core/prioritization/belief_prioritizer.py +231 -0
- mannf/core/prioritization/risk_scorer.py +430 -0
- mannf/core/reporting/__init__.py +12 -0
- mannf/core/reporting/unified_report.py +664 -0
- mannf/core/testing/__init__.py +17 -0
- mannf/core/testing/adaptive_controller.py +149 -0
- mannf/core/testing/models.py +179 -0
- mannf/core/validation/__init__.py +10 -0
- mannf/core/validation/self_validation_runner.py +180 -0
- mannf/dashboard/__init__.py +7 -0
- mannf/dashboard/app.py +9 -0
- mannf/dashboard/models.py +9 -0
- mannf/dashboard/static/index.html +2538 -0
- mannf/dashboard/telemetry.py +9 -0
- mannf/distributed/__init__.py +7 -0
- mannf/distributed/endpoint.py +9 -0
- mannf/distributed/system_under_test.py +9 -0
- mannf/healing/__init__.py +7 -0
- mannf/healing/graphql_schema_diff.py +9 -0
- mannf/healing/healer.py +9 -0
- mannf/healing/models.py +9 -0
- mannf/healing/schema_diff.py +9 -0
- mannf/integrations/__init__.py +7 -0
- mannf/integrations/auth.py +9 -0
- mannf/integrations/graphql_parser.py +9 -0
- mannf/integrations/graphql_sut.py +9 -0
- mannf/integrations/http_sut.py +9 -0
- mannf/integrations/openapi_parser.py +9 -0
- mannf/integrations/postman_parser.py +9 -0
- mannf/llm/__init__.py +7 -0
- mannf/llm/anthropic_provider.py +9 -0
- mannf/llm/base.py +9 -0
- mannf/llm/config.py +9 -0
- mannf/llm/factory.py +9 -0
- mannf/llm/openai_provider.py +9 -0
- mannf/llm/prompts.py +9 -0
- mannf/messaging/__init__.py +7 -0
- mannf/messaging/bus.py +9 -0
- mannf/messaging/messages.py +9 -0
- mannf/nat_orchestrator.py +9 -0
- mannf/neural/__init__.py +7 -0
- mannf/orchestrator.py +9 -0
- mannf/prioritization/__init__.py +7 -0
- mannf/prioritization/adaptive_controller.py +9 -0
- mannf/prioritization/belief_prioritizer.py +9 -0
- mannf/prioritization/risk_scorer.py +9 -0
- mannf/product/__init__.py +29 -0
- mannf/product/admin/__init__.py +3 -0
- mannf/product/admin/routes.py +514 -0
- mannf/product/auth/__init__.py +5 -0
- mannf/product/auth/saml.py +212 -0
- mannf/product/billing/__init__.py +5 -0
- mannf/product/billing/audit.py +160 -0
- mannf/product/billing/feature_gates.py +180 -0
- mannf/product/billing/metering.py +179 -0
- mannf/product/billing/notifications.py +181 -0
- mannf/product/billing/plans.py +133 -0
- mannf/product/billing/rate_limits.py +35 -0
- mannf/product/billing/stripe_billing.py +906 -0
- mannf/product/billing/tenant_auth.py +233 -0
- mannf/product/billing/tenant_manager.py +873 -0
- mannf/product/cli.py +3900 -0
- mannf/product/cli_admin.py +408 -0
- mannf/product/dashboard/__init__.py +61 -0
- mannf/product/dashboard/app.py +3567 -0
- mannf/product/dashboard/models.py +460 -0
- mannf/product/dashboard/static/index.html +6347 -0
- mannf/product/dashboard/static/manifest.json +25 -0
- mannf/product/dashboard/static/pwa-icon-192.png +0 -0
- mannf/product/dashboard/static/pwa-icon-512.png +0 -0
- mannf/product/dashboard/static/sw.js +64 -0
- mannf/product/dashboard/telemetry.py +547 -0
- mannf/product/database.py +145 -0
- mannf/product/demo.py +844 -0
- mannf/product/doctor.py +509 -0
- mannf/product/exporters/__init__.py +65 -0
- mannf/product/exporters/azuredevops_exporter.py +257 -0
- mannf/product/exporters/base.py +307 -0
- mannf/product/exporters/bugzilla_exporter.py +200 -0
- mannf/product/exporters/dedup.py +275 -0
- mannf/product/exporters/finding_adapter.py +216 -0
- mannf/product/exporters/github_exporter.py +197 -0
- mannf/product/exporters/gitlab_exporter.py +215 -0
- mannf/product/exporters/jira_exporter.py +180 -0
- mannf/product/exporters/linear_exporter.py +195 -0
- mannf/product/exporters/loader.py +233 -0
- mannf/product/exporters/pagerduty_exporter.py +363 -0
- mannf/product/exporters/sentry_exporter.py +322 -0
- mannf/product/exporters/servicenow_exporter.py +240 -0
- mannf/product/exporters/shortcut_exporter.py +231 -0
- mannf/product/exporters/webhook_exporter.py +383 -0
- mannf/product/formatters/__init__.py +18 -0
- mannf/product/formatters/allure_formatter.py +161 -0
- mannf/product/formatters/ctrf_formatter.py +149 -0
- mannf/product/healing/__init__.py +30 -0
- mannf/product/healing/graphql_schema_diff.py +152 -0
- mannf/product/healing/healer.py +141 -0
- mannf/product/healing/models.py +175 -0
- mannf/product/healing/schema_diff.py +251 -0
- mannf/product/ingestors/__init__.py +77 -0
- mannf/product/ingestors/base.py +256 -0
- mannf/product/ingestors/bgstm_ingestor.py +764 -0
- mannf/product/ingestors/curl_ingestor.py +1019 -0
- mannf/product/ingestors/cypress_ingestor.py +487 -0
- mannf/product/ingestors/gherkin_ingestor.py +967 -0
- mannf/product/ingestors/graphql_ingestor.py +845 -0
- mannf/product/ingestors/grpc_ingestor.py +591 -0
- mannf/product/ingestors/har_ingestor.py +976 -0
- mannf/product/ingestors/loader.py +284 -0
- mannf/product/ingestors/models.py +146 -0
- mannf/product/ingestors/openapi_ingestor.py +606 -0
- mannf/product/ingestors/playwright_ingestor.py +449 -0
- mannf/product/ingestors/postman_ingestor.py +631 -0
- mannf/product/ingestors/traffic_ingestor.py +679 -0
- mannf/product/ingestors/websocket_ingestor.py +526 -0
- mannf/product/integrations/__init__.py +21 -0
- mannf/product/integrations/auth.py +190 -0
- mannf/product/integrations/graphql_parser.py +436 -0
- mannf/product/integrations/graphql_sut.py +247 -0
- mannf/product/integrations/grpc_sut.py +469 -0
- mannf/product/integrations/http_sut.py +237 -0
- mannf/product/integrations/kafka_adapter.py +342 -0
- mannf/product/integrations/openapi_parser.py +513 -0
- mannf/product/integrations/postman_parser.py +467 -0
- mannf/product/integrations/webhook_receiver.py +344 -0
- mannf/product/integrations/websocket_sut.py +434 -0
- mannf/product/llm/__init__.py +25 -0
- mannf/product/llm/anthropic_provider.py +94 -0
- mannf/product/llm/base.py +267 -0
- mannf/product/llm/config.py +48 -0
- mannf/product/llm/factory.py +42 -0
- mannf/product/llm/openai_provider.py +93 -0
- mannf/product/llm/prompts.py +403 -0
- mannf/product/llm/root_cause_service.py +311 -0
- mannf/product/llm/test_plan_models.py +78 -0
- mannf/product/metrics.py +149 -0
- mannf/product/middleware/__init__.py +3 -0
- mannf/product/middleware/audit_middleware.py +112 -0
- mannf/product/middleware/tenant_isolation.py +114 -0
- mannf/product/models.py +347 -0
- mannf/product/notifications/__init__.py +24 -0
- mannf/product/notifications/dispatcher.py +411 -0
- mannf/product/onboarding.py +190 -0
- mannf/product/orchestration/__init__.py +39 -0
- mannf/product/orchestration/ingest_scan_orchestrator.py +339 -0
- mannf/product/orchestration/pipeline.py +401 -0
- mannf/product/orchestrator.py +987 -0
- mannf/product/orchestrator_models.py +269 -0
- mannf/product/regression/__init__.py +36 -0
- mannf/product/regression/differ.py +172 -0
- mannf/product/regression/masking.py +100 -0
- mannf/product/regression/models.py +232 -0
- mannf/product/regression/recorder.py +124 -0
- mannf/product/regression/replayer.py +168 -0
- mannf/product/reports/__init__.py +10 -0
- mannf/product/reports/pdf.py +132 -0
- mannf/product/scheduling/__init__.py +57 -0
- mannf/product/scheduling/cron_utils.py +251 -0
- mannf/product/scheduling/engine.py +473 -0
- mannf/product/scheduling/models.py +86 -0
- mannf/product/scheduling/queue.py +894 -0
- mannf/product/scheduling/store.py +235 -0
- mannf/product/security/__init__.py +21 -0
- mannf/product/security/belief_guided.py +143 -0
- mannf/product/security/checks/__init__.py +55 -0
- mannf/product/security/checks/base.py +69 -0
- mannf/product/security/checks/bfla.py +77 -0
- mannf/product/security/checks/bola.py +77 -0
- mannf/product/security/checks/bopla.py +80 -0
- mannf/product/security/checks/broken_auth.py +86 -0
- mannf/product/security/checks/graphql_security.py +299 -0
- mannf/product/security/checks/inventory.py +70 -0
- mannf/product/security/checks/misconfig.py +158 -0
- mannf/product/security/checks/resource_consumption.py +70 -0
- mannf/product/security/checks/sensitive_flows.py +80 -0
- mannf/product/security/checks/ssrf.py +101 -0
- mannf/product/security/checks/unsafe_consumption.py +120 -0
- mannf/product/security/models.py +92 -0
- mannf/product/security/plugin_loader.py +182 -0
- mannf/product/security/reporter.py +92 -0
- mannf/product/security/scanner.py +183 -0
- mannf/product/server.py +6220 -0
- mannf/product/setup_wizard.py +873 -0
- mannf/product/status.py +404 -0
- mannf/product/storage/__init__.py +10 -0
- mannf/product/storage/artifact_store.py +343 -0
- mannf/product/telemetry.py +300 -0
- mannf/product/uninstall.py +169 -0
- mannf/product/upgrade.py +139 -0
- mannf/product/weights/__init__.py +13 -0
- mannf/product/weights/blob_store.py +299 -0
- mannf/product/weights/factory.py +42 -0
- mannf/product/weights/registry.py +159 -0
- mannf/product/weights/store.py +210 -0
- mannf/regression/__init__.py +7 -0
- mannf/regression/differ.py +9 -0
- mannf/regression/masking.py +9 -0
- mannf/regression/models.py +9 -0
- mannf/regression/recorder.py +9 -0
- mannf/regression/replayer.py +9 -0
- mannf/security/__init__.py +7 -0
- mannf/security/belief_guided.py +9 -0
- mannf/security/checks/__init__.py +7 -0
- mannf/security/checks/base.py +9 -0
- mannf/security/checks/bfla.py +9 -0
- mannf/security/checks/bola.py +9 -0
- mannf/security/checks/bopla.py +9 -0
- mannf/security/checks/broken_auth.py +9 -0
- mannf/security/checks/graphql_security.py +9 -0
- mannf/security/checks/inventory.py +9 -0
- mannf/security/checks/misconfig.py +9 -0
- mannf/security/checks/resource_consumption.py +9 -0
- mannf/security/checks/sensitive_flows.py +9 -0
- mannf/security/checks/ssrf.py +9 -0
- mannf/security/checks/unsafe_consumption.py +9 -0
- mannf/security/models.py +9 -0
- mannf/security/reporter.py +9 -0
- mannf/security/scanner.py +9 -0
- mannf/server.py +9 -0
- mannf/testing/__init__.py +7 -0
- mannf/testing/adaptive_controller.py +9 -0
- mannf/testing/models.py +9 -0
- mannf/weights/__init__.py +7 -0
- mannf/weights/registry.py +9 -0
- mannf/weights/store.py +9 -0
- nat_engine-1.dist-info/METADATA +555 -0
- nat_engine-1.dist-info/RECORD +299 -0
- nat_engine-1.dist-info/WHEEL +5 -0
- nat_engine-1.dist-info/entry_points.txt +4 -0
- nat_engine-1.dist-info/licenses/LICENSE +651 -0
- nat_engine-1.dist-info/licenses/NOTICE +178 -0
- nat_engine-1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
# Copyright (C) 2026 Brad Guider
|
|
2
|
+
# This file is part of NAT (Neural Agent Testing Framework).
|
|
3
|
+
# Licensed under the AGPL-3.0. See LICENSE for details.
|
|
4
|
+
# Commercial licensing available — see COMMERCIAL_LICENSE.md.
|
|
5
|
+
|
|
6
|
+
"""Prompt templates for LLM-augmented test generation."""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
EDGE_CASE_PROMPT = """\
|
|
11
|
+
You are a software testing expert specialising in API testing.
|
|
12
|
+
|
|
13
|
+
Given the following API endpoint specification, generate {n} edge-case test inputs \
|
|
14
|
+
that might expose bugs, boundary violations, or unexpected behaviour.
|
|
15
|
+
|
|
16
|
+
Endpoint:
|
|
17
|
+
Method: {method}
|
|
18
|
+
Path: {path}
|
|
19
|
+
Description: {description}
|
|
20
|
+
Parameters: {parameters}
|
|
21
|
+
Request body schema: {schema}
|
|
22
|
+
|
|
23
|
+
Respond with a valid JSON array of test case objects. Each object must have:
|
|
24
|
+
- "inputs": dict of input fields and their values
|
|
25
|
+
- "expected_behavior": short string describing the expected outcome
|
|
26
|
+
- "test_type": one of "edge_case", "boundary", "negative"
|
|
27
|
+
|
|
28
|
+
Return ONLY the JSON array with no surrounding markdown or explanation."""
|
|
29
|
+
|
|
30
|
+
ADVERSARIAL_PROMPT = """\
|
|
31
|
+
You are a security researcher specialising in API penetration testing.
|
|
32
|
+
|
|
33
|
+
Generate {n} adversarial or malicious test inputs for the following API endpoint \
|
|
34
|
+
that might reveal security vulnerabilities (injection, auth bypass, IDOR, etc.).
|
|
35
|
+
|
|
36
|
+
Endpoint:
|
|
37
|
+
Method: {method}
|
|
38
|
+
Path: {path}
|
|
39
|
+
Description: {description}
|
|
40
|
+
Parameters: {parameters}
|
|
41
|
+
Request body schema: {schema}
|
|
42
|
+
|
|
43
|
+
Respond with a valid JSON array of test case objects. Each object must have:
|
|
44
|
+
- "inputs": dict of input fields and their values
|
|
45
|
+
- "expected_behavior": short string describing the expected outcome
|
|
46
|
+
- "test_type": one of "injection", "auth_bypass", "idor", "adversarial"
|
|
47
|
+
|
|
48
|
+
Return ONLY the JSON array with no surrounding markdown or explanation."""
|
|
49
|
+
|
|
50
|
+
SEMANTIC_PROMPT = """\
|
|
51
|
+
You are an API testing expert.
|
|
52
|
+
|
|
53
|
+
Based on the description of the following API endpoint, generate {n} semantically \
|
|
54
|
+
meaningful test scenarios that reflect realistic usage, business logic edge cases, \
|
|
55
|
+
and common developer mistakes.
|
|
56
|
+
|
|
57
|
+
Endpoint:
|
|
58
|
+
Method: {method}
|
|
59
|
+
Path: {path}
|
|
60
|
+
Description: {description}
|
|
61
|
+
Parameters: {parameters}
|
|
62
|
+
Request body schema: {schema}
|
|
63
|
+
|
|
64
|
+
Respond with a valid JSON array of test case objects. Each object must have:
|
|
65
|
+
- "inputs": dict of input fields and their values
|
|
66
|
+
- "expected_behavior": short string describing the expected outcome
|
|
67
|
+
- "test_type": one of "semantic", "business_logic", "realistic"
|
|
68
|
+
|
|
69
|
+
Return ONLY the JSON array with no surrounding markdown or explanation."""
|
|
70
|
+
|
|
71
|
+
MUTATION_PROMPT = """\
|
|
72
|
+
You are a fuzzing expert.
|
|
73
|
+
|
|
74
|
+
Given the following test case, suggest {n} smart mutations that are more likely to \
|
|
75
|
+
expose bugs than purely random perturbations. Consider boundary values, type coercions, \
|
|
76
|
+
encoding variations, and semantic inversions.
|
|
77
|
+
|
|
78
|
+
Original test case:
|
|
79
|
+
Target: {target}
|
|
80
|
+
Inputs: {inputs}
|
|
81
|
+
Expected behaviour: {expected_behavior}
|
|
82
|
+
|
|
83
|
+
Respond with a valid JSON array of mutated test case objects. Each object must have:
|
|
84
|
+
- "inputs": dict with the mutated input fields
|
|
85
|
+
- "expected_behavior": short string describing what this mutation tests
|
|
86
|
+
- "mutation_rationale": one-sentence explanation of why this mutation is interesting
|
|
87
|
+
|
|
88
|
+
Return ONLY the JSON array with no surrounding markdown or explanation."""
|
|
89
|
+
|
|
90
|
+
UI_FORM_FILL_PROMPT = """\
|
|
91
|
+
You are a software testing expert specialising in web application testing.
|
|
92
|
+
|
|
93
|
+
Given the following web form specification, generate {n} sets of realistic form fill \
|
|
94
|
+
values that represent valid user inputs for happy-path testing.
|
|
95
|
+
|
|
96
|
+
Context:
|
|
97
|
+
Locale: {locale}
|
|
98
|
+
Application domain: {domain_context}
|
|
99
|
+
|
|
100
|
+
Form:
|
|
101
|
+
Page URL: {page_url}
|
|
102
|
+
Form action: {form_action}
|
|
103
|
+
Form method: {form_method}
|
|
104
|
+
Fields:
|
|
105
|
+
{fields_description}
|
|
106
|
+
|
|
107
|
+
Field-type guidance — generate realistic values per type:
|
|
108
|
+
- email → use pattern firstname.lastname@domain.com (e.g. jane.smith@example.com)
|
|
109
|
+
- password → strong password with upper-case, lower-case, digits, and symbols \
|
|
110
|
+
(e.g. Tr0ub4dor&3)
|
|
111
|
+
- tel → locale-appropriate phone number for the given locale \
|
|
112
|
+
(e.g. +1-555-867-5309 for en-US)
|
|
113
|
+
- date → realistic recent date in YYYY-MM-DD format (within the last 5 years)
|
|
114
|
+
- number → a plausible integer or decimal within the expected range for the field \
|
|
115
|
+
label/context
|
|
116
|
+
- url → a well-formed HTTPS URL (e.g. https://example.com/path)
|
|
117
|
+
- text/other → a realistic value that matches the field label or placeholder context
|
|
118
|
+
|
|
119
|
+
Constraint rules:
|
|
120
|
+
- Every field marked required=True MUST receive a non-empty value.
|
|
121
|
+
- When a field specifies a pattern attribute, the generated value MUST match that \
|
|
122
|
+
regex pattern.
|
|
123
|
+
|
|
124
|
+
Respond with a valid JSON array of test case objects. Each object must have:
|
|
125
|
+
- "inputs": dict mapping field selectors to fill values
|
|
126
|
+
- "description": short string describing the user scenario
|
|
127
|
+
- "test_type": "happy_path"
|
|
128
|
+
|
|
129
|
+
Return ONLY the JSON array with no surrounding markdown or explanation."""
|
|
130
|
+
|
|
131
|
+
UI_NEGATIVE_PATH_PROMPT = """\
|
|
132
|
+
You are a software testing expert specialising in form validation and edge-case testing.
|
|
133
|
+
|
|
134
|
+
Given the following web form specification, generate {n} sets of invalid or edge-case \
|
|
135
|
+
form fill values that might expose validation bugs, error handling issues, or security \
|
|
136
|
+
vulnerabilities.
|
|
137
|
+
|
|
138
|
+
Form:
|
|
139
|
+
Page URL: {page_url}
|
|
140
|
+
Form action: {form_action}
|
|
141
|
+
Form method: {form_method}
|
|
142
|
+
Fields:
|
|
143
|
+
{fields_description}
|
|
144
|
+
|
|
145
|
+
Violation strategy — for each test case choose a deliberate violation:
|
|
146
|
+
- empty_required : leave a field with required=True blank or omit it entirely
|
|
147
|
+
- format_violation: supply a value that does NOT match the field's pattern attribute \
|
|
148
|
+
(e.g. for an email field try "not-an-email", for a tel field try "abc")
|
|
149
|
+
- overflow : supply an extremely long string (500+ chars) or an out-of-range number
|
|
150
|
+
- unicode : supply Unicode characters, RTL text, or emoji
|
|
151
|
+
- special_chars : supply shell/HTML special characters (<, >, ", ', ;, --)
|
|
152
|
+
- boundary : supply the minimum or maximum allowed value (0, -1, empty string, \
|
|
153
|
+
max-int)
|
|
154
|
+
- negative : supply a semantically wrong value (negative age, future birth date)
|
|
155
|
+
- xss : supply a script-injection string (e.g. <script>alert(1)</script>)
|
|
156
|
+
- injection : supply an SQL or command-injection string (e.g. ' OR '1'='1)
|
|
157
|
+
|
|
158
|
+
Per-field strategy hints:
|
|
159
|
+
- email fields : try malformed addresses (missing @, double dots, bare username)
|
|
160
|
+
- password fields : try empty string, whitespace-only, extremely long passwords
|
|
161
|
+
- number fields : try non-numeric strings, negative values, extreme values (1e308)
|
|
162
|
+
- date fields : try invalid dates (2024-02-30), far-future/past dates, wrong format
|
|
163
|
+
- required fields : always generate at least one test case that omits or empties the field
|
|
164
|
+
|
|
165
|
+
Expected behaviour guidance — set "expected_behavior" to one of:
|
|
166
|
+
"should show client-side validation error" | "should return 422" | \
|
|
167
|
+
"should return 400" | "should sanitise and store safely" | "should reject with 403"
|
|
168
|
+
|
|
169
|
+
Respond with a valid JSON array of test case objects. Each object must have:
|
|
170
|
+
- "inputs": dict mapping field selectors to fill values
|
|
171
|
+
- "expected_behavior": short string describing the expected validation response
|
|
172
|
+
- "test_type": one of "empty_required", "format_violation", "overflow", "unicode", \
|
|
173
|
+
"special_chars", "boundary", "negative", "xss", "injection"
|
|
174
|
+
|
|
175
|
+
Return ONLY the JSON array with no surrounding markdown or explanation."""
|
|
176
|
+
|
|
177
|
+
UI_FLOW_SUGGESTION_PROMPT = """\
|
|
178
|
+
You are a software testing expert specialising in user journey and end-to-end testing.
|
|
179
|
+
|
|
180
|
+
Given the following web application structure (discovered pages, forms, and navigation \
|
|
181
|
+
links), suggest {n} multi-step user journey test scenarios that would provide good \
|
|
182
|
+
coverage of the application's functionality.
|
|
183
|
+
|
|
184
|
+
Application:
|
|
185
|
+
Base URL: {base_url}
|
|
186
|
+
Pages:
|
|
187
|
+
{pages_description}
|
|
188
|
+
Navigation edges:
|
|
189
|
+
{edges_description}
|
|
190
|
+
|
|
191
|
+
Journey composition rules:
|
|
192
|
+
- Prefer journeys that are 3–7 steps long and cross at least one page boundary.
|
|
193
|
+
- Include a mix of critical paths (login, checkout, registration) and exploratory paths.
|
|
194
|
+
- When a page contains a form, the journey MUST include fill steps for each visible \
|
|
195
|
+
field followed by a click on the submit button selector. Do NOT use "submit_form" — \
|
|
196
|
+
form submission must be represented as a "click" action on the submit button selector.
|
|
197
|
+
- Valid action values are: navigate, fill, click. No other actions are permitted.
|
|
198
|
+
|
|
199
|
+
Respond with a valid JSON array of test scenario objects. Each object must have:
|
|
200
|
+
- "name": short scenario name
|
|
201
|
+
- "steps": array of step objects, each with "action" (navigate/fill/click), \
|
|
202
|
+
"selector" (CSS selector or URL for navigate), and optionally "value" (for fill)
|
|
203
|
+
- "description": one-sentence description of what this journey tests
|
|
204
|
+
- "priority": one of "critical", "high", "medium", "low"
|
|
205
|
+
|
|
206
|
+
Return ONLY the JSON array with no surrounding markdown or explanation."""
|
|
207
|
+
|
|
208
|
+
UI_SECURITY_PAYLOAD_PROMPT = """\
|
|
209
|
+
You are a web application security expert specialising in browser-level penetration testing.
|
|
210
|
+
|
|
211
|
+
Given the following web form specification, generate {n} targeted security test payloads \
|
|
212
|
+
that attempt to expose injection vulnerabilities, XSS, path traversal, SSRF, or other \
|
|
213
|
+
OWASP Top 10 weaknesses by injecting attack strings into form fields.
|
|
214
|
+
|
|
215
|
+
Form:
|
|
216
|
+
Page URL: {page_url}
|
|
217
|
+
Form action: {form_action}
|
|
218
|
+
Form method: {form_method}
|
|
219
|
+
Fields:
|
|
220
|
+
{fields_description}
|
|
221
|
+
|
|
222
|
+
Attack categories to cover (choose the most relevant per field):
|
|
223
|
+
- xss : inject script/event-handler payloads to test for reflected/stored XSS
|
|
224
|
+
- sql_injection : inject SQL metacharacters to test for SQL injection
|
|
225
|
+
- nosql_injection : inject NoSQL operator objects (e.g. {{"$gt":""}}) for NoSQL injection
|
|
226
|
+
- path_traversal : inject directory traversal sequences (e.g. ../../etc/passwd) for file fields
|
|
227
|
+
- crlf_injection : inject \\r\\n sequences to test for header/log injection
|
|
228
|
+
- ssrf : inject internal URLs (e.g. http://127.0.0.1) for URL-accepting fields
|
|
229
|
+
- proto_pollution : inject __proto__ keys for fields that feed JSON objects
|
|
230
|
+
- unicode_attack : inject Unicode homoglyphs or RTL overrides to bypass filters
|
|
231
|
+
|
|
232
|
+
Field-type guidance:
|
|
233
|
+
- text/textarea/search : xss, sql_injection, crlf_injection, unicode_attack
|
|
234
|
+
- url fields : ssrf, path_traversal
|
|
235
|
+
- email fields : xss, sql_injection (via the local part)
|
|
236
|
+
- password fields : sql_injection, unicode_attack
|
|
237
|
+
|
|
238
|
+
Constraint rules:
|
|
239
|
+
- Each test case MUST target exactly one field with an attack payload.
|
|
240
|
+
- All other required fields should receive safe, valid values.
|
|
241
|
+
- Choose payloads that have a realistic chance of bypassing basic sanitization.
|
|
242
|
+
|
|
243
|
+
Respond with a valid JSON array of test case objects. Each object must have:
|
|
244
|
+
- "inputs": dict mapping exactly the attacking field's selector to the attack payload \
|
|
245
|
+
and all other fillable fields to safe values
|
|
246
|
+
- "description": one sentence describing what vulnerability this tests
|
|
247
|
+
- "payload_type": one of "xss", "sql_injection", "nosql_injection", "path_traversal", \
|
|
248
|
+
"crlf_injection", "ssrf", "proto_pollution", "unicode_attack"
|
|
249
|
+
- "target_field": the selector of the field receiving the attack payload
|
|
250
|
+
|
|
251
|
+
Return ONLY the JSON array with no surrounding markdown or explanation."""
|
|
252
|
+
|
|
253
|
+
ROOT_CAUSE_ANALYSIS_PROMPT = """\
|
|
254
|
+
You are an expert software reliability engineer specialising in web application \
|
|
255
|
+
test automation and root cause analysis.
|
|
256
|
+
|
|
257
|
+
A browser-based autonomous test has detected a failure. Using the information \
|
|
258
|
+
below, identify the most likely root cause and suggest where an engineer should \
|
|
259
|
+
start debugging.
|
|
260
|
+
|
|
261
|
+
Failure details:
|
|
262
|
+
URL: {url}
|
|
263
|
+
Page key: {page}
|
|
264
|
+
Error message: {error}
|
|
265
|
+
Task ID: {task_id}
|
|
266
|
+
Fault likelihood (belief state): {fault_likelihood}
|
|
267
|
+
|
|
268
|
+
Belief history for this page (most recent first):
|
|
269
|
+
{belief_history}
|
|
270
|
+
|
|
271
|
+
Scenario steps that were executing when the failure occurred:
|
|
272
|
+
{scenario_steps}
|
|
273
|
+
|
|
274
|
+
DOM snapshot (truncated):
|
|
275
|
+
{dom_snapshot}
|
|
276
|
+
|
|
277
|
+
Page metadata:
|
|
278
|
+
{page_metadata}
|
|
279
|
+
|
|
280
|
+
Based on the above, provide a structured JSON response with the following fields:
|
|
281
|
+
- "likely_cause": one-sentence description of the most probable root cause
|
|
282
|
+
- "suggested_fix": concise actionable suggestion for where to start debugging \
|
|
283
|
+
(e.g. "Check the /api/checkout timeout configuration — the belief trend shows \
|
|
284
|
+
sustained degradation over 3 runs")
|
|
285
|
+
- "confidence": float 0.0–1.0 indicating your confidence in this root cause \
|
|
286
|
+
(use lower values when limited context is available)
|
|
287
|
+
- "files_to_check": list of source file paths or component names most likely \
|
|
288
|
+
to contain the defect (empty list when unknown)
|
|
289
|
+
|
|
290
|
+
Return ONLY the JSON object with no surrounding markdown or explanation."""
|
|
291
|
+
|
|
292
|
+
TEST_PLAN_PROMPT = """\
|
|
293
|
+
You are a senior API security and quality engineer.
|
|
294
|
+
|
|
295
|
+
Given the following structured summary of an API specification, produce a \
|
|
296
|
+
comprehensive test plan as a JSON object.
|
|
297
|
+
|
|
298
|
+
API summary:
|
|
299
|
+
{api_summary}
|
|
300
|
+
|
|
301
|
+
Your test plan MUST be a JSON object with exactly these top-level fields:
|
|
302
|
+
- "endpoint_groups": array of group objects (see below) — order by descending priority
|
|
303
|
+
- "estimated_coverage": float 0.0–1.0 indicating estimated coverage if the full plan is executed
|
|
304
|
+
|
|
305
|
+
Each group object must have:
|
|
306
|
+
- "name": short human-readable group name (e.g. "Authentication", "User CRUD")
|
|
307
|
+
- "endpoints": list of strings in "METHOD /path" format belonging to this group
|
|
308
|
+
- "priority": one of "critical", "high", "medium", "low"
|
|
309
|
+
- "risk_assessment": one-to-two sentence description of the risk profile for this group
|
|
310
|
+
- "suggested_strategies": list of concise test strategy strings \
|
|
311
|
+
(e.g. "boundary value analysis", "auth bypass", "IDOR", "SQL injection", "rate limiting")
|
|
312
|
+
- "edge_cases": list of concise edge-case or business-logic scenario strings
|
|
313
|
+
|
|
314
|
+
Grouping rules:
|
|
315
|
+
- Group endpoints by functional domain (auth, users, payments, admin, etc.)
|
|
316
|
+
- Mark as "critical" any group that handles authentication, authorisation, payments, or PII
|
|
317
|
+
- Mark as "high" any group with complex business logic or data mutation
|
|
318
|
+
- Mark as "medium" read-only endpoints with filtering/pagination
|
|
319
|
+
- Mark as "low" health-check, metadata, or purely informational endpoints
|
|
320
|
+
|
|
321
|
+
Return ONLY the JSON object with no surrounding markdown or explanation."""
|
|
322
|
+
|
|
323
|
+
NL_TEST_AUTHORING_PROMPT = """\
|
|
324
|
+
You are a senior software testing engineer specialising in both API and browser-based \
|
|
325
|
+
end-to-end testing.
|
|
326
|
+
|
|
327
|
+
A user has described what they want to test in plain English. Your job is to translate \
|
|
328
|
+
that description into a list of concrete, executable test scenarios that can be run by \
|
|
329
|
+
the NAT testing framework.
|
|
330
|
+
|
|
331
|
+
User description: {description}
|
|
332
|
+
|
|
333
|
+
Context (may be empty):
|
|
334
|
+
Base URL: {base_url}
|
|
335
|
+
Auth type: {auth_type}
|
|
336
|
+
Known endpoints: {known_endpoints}
|
|
337
|
+
|
|
338
|
+
Generate a JSON array of test scenario objects. Each scenario MUST be one of two types:
|
|
339
|
+
|
|
340
|
+
**API scenario** (for REST/HTTP tests):
|
|
341
|
+
- "type": "api"
|
|
342
|
+
- "name": short scenario name
|
|
343
|
+
- "description": one-sentence description of what this tests
|
|
344
|
+
- "method": HTTP method (GET, POST, PUT, PATCH, DELETE)
|
|
345
|
+
- "path": URL path (relative to base_url, e.g. "/users/123")
|
|
346
|
+
- "headers": dict of request headers (may be empty)
|
|
347
|
+
- "body": dict of request body fields (may be empty)
|
|
348
|
+
- "assertions": list of assertion strings describing expected behaviour \
|
|
349
|
+
(e.g. "status 200", "body.id is not null", "status 403 when not authenticated")
|
|
350
|
+
- "priority": one of "critical", "high", "medium", "low"
|
|
351
|
+
|
|
352
|
+
**Browser scenario** (for UI/end-to-end tests):
|
|
353
|
+
- "type": "browser"
|
|
354
|
+
- "name": short scenario name
|
|
355
|
+
- "description": one-sentence description of what this tests
|
|
356
|
+
- "steps": array of step objects, each with:
|
|
357
|
+
- "action": one of "navigate", "fill", "click"
|
|
358
|
+
- "selector": CSS selector or URL (for navigate)
|
|
359
|
+
- "value": string value (required for fill, omit for navigate/click)
|
|
360
|
+
- "assertions": list of assertion strings describing expected behaviour
|
|
361
|
+
- "priority": one of "critical", "high", "medium", "low"
|
|
362
|
+
|
|
363
|
+
Rules:
|
|
364
|
+
- Choose API scenarios for backend/REST tests, browser scenarios for UI/form tests.
|
|
365
|
+
- Generate between 2 and 8 scenarios that together give good coverage of the description.
|
|
366
|
+
- Prefer security-relevant scenarios (auth, IDOR, injection) when the description \
|
|
367
|
+
mentions access control, tenants, or sensitive data.
|
|
368
|
+
- For browser scenarios, each form submission MUST be a "click" on the submit button \
|
|
369
|
+
(do NOT use "submit_form").
|
|
370
|
+
|
|
371
|
+
Return ONLY the JSON array with no surrounding markdown or explanation."""
|
|
372
|
+
|
|
373
|
+
UI_ACCESSIBILITY_PROMPT = """\
|
|
374
|
+
You are an accessibility testing expert specialising in WCAG 2.1 compliance and \
|
|
375
|
+
assistive technology compatibility.
|
|
376
|
+
|
|
377
|
+
Given the following web page specification, generate {n} accessibility-focused test \
|
|
378
|
+
cases that verify the page is usable by people relying on keyboard navigation, screen \
|
|
379
|
+
readers, and other assistive technologies.
|
|
380
|
+
|
|
381
|
+
Page:
|
|
382
|
+
URL: {page_url}
|
|
383
|
+
Fields / interactive elements:
|
|
384
|
+
{fields_description}
|
|
385
|
+
|
|
386
|
+
Test categories to cover:
|
|
387
|
+
- keyboard_nav : verify that all interactive elements are reachable and operable \
|
|
388
|
+
using Tab / Shift-Tab / Enter / Space / arrow keys without a mouse
|
|
389
|
+
- aria_labels : verify that every input, button, and landmark has a non-empty, \
|
|
390
|
+
meaningful aria-label or aria-labelledby attribute
|
|
391
|
+
- screen_reader : verify that dynamic content changes (errors, confirmations) are \
|
|
392
|
+
announced via aria-live regions or role="alert"
|
|
393
|
+
- focus_management: verify that focus moves to a logical next element after form \
|
|
394
|
+
submission, dialog open/close, or page navigation
|
|
395
|
+
|
|
396
|
+
For each test case provide:
|
|
397
|
+
- "inputs": dict mapping field/element selectors to the simulated interaction or \
|
|
398
|
+
expected attribute value to verify
|
|
399
|
+
- "description": one sentence describing what accessibility property is being verified
|
|
400
|
+
- "test_type": one of "keyboard_nav", "aria_labels", "screen_reader", "focus_management"
|
|
401
|
+
|
|
402
|
+
Respond with a valid JSON array of {n} test case objects.
|
|
403
|
+
Return ONLY the JSON array with no surrounding markdown or explanation."""
|