# /test - Comprehensive Test Generation and Execution

**Agent:** `tester`

Generate and run comprehensive tests for the Movement dApp.

**IMPORTANT**: Delegate to `tester` agent.

## Workflow

### Step 1: Analyze Codebase
Scan the project to identify:
- Move contracts in `contracts/sources/`
- Frontend code in `frontend/src/`
- Existing tests

### Step 2: Generate Move Tests
For each Move module, generate tests in `contracts/tests/`:

```move
#[test_only]
module test_module_name {
    use std::signer;
    use aptos_framework::account;

    #[test(account = @0x1)]
    fun test_function_name(account: &signer) {
        // Setup
        // Action
        // Assert
    }

    #[test]
    #[expected_failure(abort_code = ERROR_CODE)]
    fun test_failure_case() {
        // Test error conditions
    }
}
```

### Step 3: Run All Tests

1. **Move Tests**
   ```bash
   cd contracts && movement move test
   ```

2. **Frontend Tests**
   ```bash
   cd frontend && npm test
   ```

### Step 4: Generate Coverage Report
Analyze test coverage and identify gaps:
- Line coverage
- Branch coverage
- Function coverage

### Step 5: Report Results
```markdown
# 🧪 Test Results

## Move Contract Tests
| Module | Tests | Passed | Failed | Coverage |
|--------|-------|--------|--------|----------|
| module_name | 10 | 10 | 0 | 95% |

## Frontend Tests
| Component | Tests | Passed | Failed | Coverage |
|-----------|-------|--------|--------|----------|
| ComponentName | 8 | 8 | 0 | 88% |

## Overall Coverage: 91%

## Recommendations
- Add tests for {uncovered areas}
- Consider edge cases for {specific functions}
```

## Sub-Commands

### /test:contracts
Run only Move contract tests

### /test:frontend
Run only frontend tests

### /test:coverage
Generate detailed coverage report

## Success Criteria
- All tests generated in <3 minutes
- All tests passing
- Coverage >90%
- No security vulnerabilities in test code

