Skip to content
Back to skills

Testing

ASecurity

- **Tests**: 30/30 passed - **Execution Time**: 27.38s - **Framework**: Pester 5.7.1

  • 47 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 27, 2026
data-aishelltestingapiperformance

Works with

  • api

Security analysis

A100/100

Pro scans all 14 files and shows the line behind each finding

Scanned May 27, 2026

npx -y skills add rjmurillo/ai-agents --skill testing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Testing?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Testing
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/rjmurillo-testing/badge)](https://www.skillsdirectory.com/skills/rjmurillo-testing)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Testing: Get-PRChecks.ps1 Skill

## Test Results (2025-12-28)

- **Tests**: 30/30 passed
- **Execution Time**: 27.38s
- **Framework**: Pester 5.7.1

## Coverage Analysis

### Feature Areas Tested

| Area | Tests | Coverage |
|------|-------|----------|
| Parameter validation | 6 | Complete |
| SUCCESS states | 3 | Complete (SUCCESS, NEUTRAL, SKIPPED) |
| FAILURE states | 4 | Complete (FAILURE, CANCELLED, TIMED_OUT, ACTION_REQUIRED) |
| PENDING states | 3 | Complete (QUEUED, IN_PROGRESS, WAITING) |
| Legacy StatusContext | 4 | Complete |
| Edge cases | 3 | Complete (no commits, null rollup, empty contexts) |
| RequiredOnly filtering | 2 | Complete |
| Output structure | 4 | Complete |

### Known Coverage Gaps

1. **Exit codes 2, 3, 7**: Error and timeout exit codes not tested (GraphQL mock limitation)
2. **Wait/polling logic**: Timeout behavior not exercised (timing complexity)
3. **Pagination (>100 checks)**: Edge case untested

## Testing Insights

### Mock Design Pattern

Helper function `New-MockGraphQLResponse` provides flexible test data generation:

```powershell
function New-MockGraphQLResponse {
    param(
        [int]$Number = 50,
        [string]$OverallState = 'SUCCESS',
        [array]$CheckRuns = @(),
        [array]$StatusContexts = @(),
        [switch]$NoPR,
        [switch]$NoCommits,
        [switch]$NoRollup
    )
    # Returns structured GraphQL response hashtable
}
```

Benefits:
- Parameterized edge case generation (NoPR, NoCommits, NoRollup switches)
- Supports both CheckRun and StatusContext types
- Easily extended for new test scenarios

### Test Execution Performance

Individual test times:
- Parameter validation: 3-78ms (fast)
- State classification: 900ms-2.1s (script loading overhead)

Performance factor: Tests dot-source script (`. $Script:ScriptPath`) for each scenario, adding 900ms+ overhead per test.

Optimization opportunity: Cache script loading in BeforeAll (would reduce 27s to <10s).

### Function Testing Approach

Tests directly invoke internal functions after dot-sourcing:

```powershell
. $Script:ScriptPath -PullRequest 1 -ErrorAction SilentlyContinue 2>$null
$result = Get-ChecksFromResponse -Response $mockResponse
```

This provides unit-level isolation for helper functions (Get-ChecksFromResponse, Build-Output, ConvertTo-CheckInfo).

## Recommendations for Future Skill Tests

1. **Add integration test tier**: One real API test per skill for exit code validation
2. **Document coverage gaps**: Explicitly note mock limitations in test file comments
3. **Performance consideration**: Cache script loading when testing multiple scenarios
4. **Negative parameter tests**: Validate invalid parameter combinations fail correctly

## Exit Code Verification

| Code | Meaning | Validation Status |
|------|---------|-------------------|
| 0 | All passing/pending | Implicit in SUCCESS tests |
| 1 | Checks failed | Implicit in FAILURE tests |
| 2 | PR not found | Not tested (mock limitation) |
| 3 | API error | Not tested (mock limitation) |
| 7 | Timeout | Not tested (polling complexity) |

## Quality Assessment

**Overall**: High confidence in implementation correctness.

**Strengths**:
- Comprehensive state coverage (all documented conclusions/statuses)
- Legacy API compatibility validated
- Edge case handling verified
- Output structure validated

**Acceptable Gaps**:
- Error exit codes (integration test territory)
- Polling logic (complex timing test)
- Pagination edge case (rare scenario)

## Related

- [testing-002-test-first-development](testing-002-test-first-development.md)
- [testing-003-script-execution-isolation](testing-003-script-execution-isolation.md)
- [testing-004-coverage-pragmatism](testing-004-coverage-pragmatism.md)
- [testing-007-contract-testing](testing-007-contract-testing.md)
- [testing-008-entry-point-isolation](testing-008-entry-point-isolation.md)

Files in this skill

  • issue-998-graph-traversal-verification.md1.7 KB
  • test-citation-verification.md498 B
  • testing-002-test-first-development.md3.9 KB
  • testing-003-script-execution-isolation.md3 KB
  • testing-004-coverage-pragmatism.md5 KB
  • testing-007-contract-testing.md4.6 KB
  • testing-008-entry-point-isolation.md5.1 KB
  • testing-coverage-philosophy-integration.md4.5 KB
  • testing-coverage-requirements.md3.4 KB
  • testing-exit-code-interpretation.md2.5 KB
  • testing-get-pr-checks-skill.md3.8 KB
  • testing-mock-fidelity.md7.2 KB
  • testing-observations.md13.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.