from langchain_core.prompts import PromptTemplate

PERFORMANCE_TEST_CASE_PROMPT = PromptTemplate.from_template("""
You are a **senior QA engineer**. Analyze the provided code and generate a detailed **Performance & Stress Test Case Document** in clean, consistent **Markdown** format.

---

### 📌 Formatting Rules:
- Use only **Markdown syntax**. No HTML, custom tags, or blockquotes.
- Start each main section with a **`#` or `##` heading** (not `###`).
- Use **bullet points** for lists and **bold** for field labels.
- Insert **exactly one blank line** between sections and list items for clarity.
- Do **not include** any summary or intro outside the structured format.

---

### 📄 Required Document Sections:

# Performance Test Case Document

## 1. Objectives

- Briefly state the performance goals of the pipeline.
- Include what will be measured and why it matters for the system.

## 2. Scope

- Define which components or features are in-scope and out-of-scope for testing.
- Mention any assumptions or constraints.

## 3. Performance Metrics

- List metrics like throughput, response time, latency, memory usage, CPU load.
- Define thresholds for pass/fail evaluation.

## 4. Test Environment

- Specify hardware, software, network, tools (e.g., Locust, JMeter).
- Detail configuration settings, test data setup, and monitoring tools.

## 5. Test Scenarios
- Outline the key performance scenarios:
  - Normal Load
  - Peak Load
  - Extended Duration Load
  - Concurrent Execution
  - Batch vs Real-time differences (if any)

## 6. Detailed Test Cases
Each test case must follow this structure and be separated clearly using `###`:

### Test Case: <Descriptive Name>
- **Preconditions**: <Initial setup, e.g., table setup, pipeline deployed>
- **Steps**:
  - Step 1: ...
  - Step 2: ...
- **Expected Results**: <Expected behavior or outputs>
- **Pass/Fail Criteria**: <Thresholds or KPIs>
- **SQL or Code to Run**: 

_(Repeat this structure for each unique performance test.)_

## 7. Stress Testing
### Stress Testing Plan
- **Purpose**: Identify system limits, failure points, and recovery behavior.

### Stress Test Cases
- Generate specific, actionable stress test cases derived **directly from the logic and operations in the input code**.
- Each stress test case must follow this structure:

### Test Case: <Descriptive Name>
- **Preconditions**: <What needs to be in place to run this>
- **Steps**:
  - Step 1: ...
  - Step 2: ...
- **Expected Results**: <What should happen>
- **Pass/Fail Criteria**: <What determines a success or failure>
- **SQL or Code to Run**:  
  Include SQL or code to simulate:
  - Excessive data volume
  - Max concurrency
  - Slow I/O or latency
  - Corrupt input or schema errors

Use this format:  
\`\`\`sql  
-- SQL for setup or execution  
SELECT COUNT(*) FROM target_table;  
\`\`\`  
or  
\`\`\`python  
# PySpark logic for stressing the transformation step  
df = spark.read.parquet('data/input')  
df.repartition(1000).write.parquet('data/output')  
\`\`\`

---

### 🔍 Input
- **Project Description**: {input}
- **Reference Code**: {code}

---

Return only the fully formatted Markdown document. Do not include extra prose, commentary, or raw code.
""")


the Sql which appear on teh screen are not properly formated also not in single line  can you correct the prompt