# Single Test Case Editing

This guide provides detailed instructions for editing individual test cases in Kusho.

## Methods to Access Test Editor

### Through Test Suite View
1. Navigate to your test suite.
2. Find your test in the list.
3. Click the "Details" button.

![](details-btn.png)

4. The JSON editor will open, allowing you to edit your test case quickly. To save your changes, click the save button in the bottom right corner.

![](save-btn.png)

5. Click on Edit this test case.

![](edit-this.png)

## Working with Variables

### Accessing Variables
1. Click the "Variables" button in the toolbar.
2. A modal will open showing all available variables.
3. Each variable has:
   - Variable name
   - Variable value
   - Delete button

## Editing Steps

### 1. Understanding the Request Structure
```json
{
  "method": "GET",         // HTTP method (GET, POST, PUT, etc.)
  "url": "",   // Target endpoint URL with variable
  "headers": {
    "Authorization": "Bearer "  // Headers with variables
  },
  "path_params": {},       // URL path parameters
  "query_params": {        // Query string parameters
    "page_size": ""
  },
  "json_body": {}          // Request body for POST/PUT requests
}
```

### 2. Making Changes
1. **Update HTTP Method**
   - Click on the method value.
   - Change to required method (GET, POST, etc.).
   - Ensure proper capitalization.

2. **Modify URL**
   - Update the URL value in quotes.
   - Use variables with  syntax.
   - Include protocol (https://).

3. **Edit Query Parameters**
   - Locate the `query_params` object.
   - Add or modify key-value pairs.
   - Use variables where applicable.
   - Use proper JSON formatting.

4. **Update Request Body**
   - Find the `json_body` section.
   - Add required data in JSON format.
   - Include variables as needed.
   - Validate JSON structure.

### 3. Saving Changes

#### Individual Test Update
1. Click the "Save" button.
2. When prompted, select "Edit this test".
3. Wait for success confirmation.
4. Verify changes in the editor.

#### Testing Changes
1. Click the "Run" button next to the test.
2. Check execution status.
3. Verify the changes took effect.

## Tips for Success

### 1. Before Editing
- Review the current configuration.
- Check available variables.
- Understand the test purpose.
- Note any dependencies.
- Plan your changes.

### 2. During Editing
- Keep JSON properly formatted.
- Use variables for reusable values.
- Save changes frequently.
- Test after each significant change.
- Watch for syntax errors.

### 3. After Editing
- Run a final test.
- Review the changes.
- Document major updates.
- Check for any warnings.

## Common Issues and Solutions

### 1. Syntax Errors
- Look for highlighted error indicators.
- Check JSON formatting.
- Verify proper quotation marks.
- Ensure valid values.
- Validate variable syntax.

### 2. Save Failures
- Check for unsaved changes.
- Verify JSON validity.
- Review error messages.
- Try incremental saves.

### 3. URL Issues
- Verify protocol (http/https).
- Check URL formatting.
- Validate parameters.
- Ensure proper encoding.
- Verify variable resolution.

### 4. Variable Issues
- Check variable names.
- Verify variable values.
- Ensure proper syntax .
- Validate variable availability.

## Pro Tips

1. **Efficient Editing**
   - Make incremental changes.
   - Test frequently.
   - Keep track of changes.
   - Utilize the search function.
   - Use variables for common values.

2. **Best Practices**
   - Use consistent formatting.
   - Follow naming conventions.
   - Keep configurations clean.
   - Document significant changes.
   - Maintain organized variables.

3. **Troubleshooting**
   - Review error messages.
   - Check execution logs.
   - Test in isolation.
   - Compare with working versions.
   - Verify variable values.
