Receber por email
← Voltar para o catálogo

edge-case-generator

Automatically identify potential boundary and exception cases from requirements, specifications, or existing code, and generate comprehensive test cases targeting boundary conditions, edge cases, and uncommon scenarios. Use this skill when analyzing programs, code repositories, functions, or APIs to discover and test corner cases, null handling, overflow conditions, empty inputs, concurrent access

105estrelas
Atualizado há 8 meses

Ver no GitHub ↗ Licença: Apache-2.0

Como adicionar

/plugin marketplace add ArabelaTso/Skills-4-SE

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Para o autor da skill

Cole no README do seu repo

Mostra que sua skill está catalogada na Skillteca, gera backlink e tráfego rastreável.

[![Skillteca](https://www.skillteca.com.br/api/badge/edge-case-generator/svg)](https://www.skillteca.com.br/skills/edge-case-generator)

Skills relacionadas

Ver todas de Automação →

Alerta por categoria

Receba novas skills de Automação toda segunda

1 email curto, só com as skills novas de Automação. 4 minutos de leitura, sem spam, cancela com 1 clique.

Você confirma o email no primeiro envio. Sem spam. Cancela com 1 clique.

Ler descrição completa

Edge Case Generator

Systematically identify boundary conditions, edge cases, and exceptional scenarios, then generate comprehensive tests to validate software behavior under uncommon conditions.

Core Capabilities

1. Edge Case Identification

Analyze code, specifications, or requirements to identify:

  • Boundary values: Min/max limits, zero, empty, first/last elements
  • Null and undefined: Missing data, null pointers, undefined references
  • Type boundaries: Integer overflow, floating-point precision, type mismatches
  • Collection edge cases: Empty collections, single element, duplicates
  • State transitions: Invalid state sequences, concurrent modifications
  • Resource limits: Memory exhaustion, timeout scenarios, disk full
  • Special characters: Unicode, whitespace, control characters
  • Concurrency issues: Race conditions, deadlocks, thread safety

2. Test Generation

Generate tests in multiple formats:

  • Unit tests (pytest, Jest, JUnit, Go testing, etc.)
  • Integration test scenarios
  • Property-based tests (Hypothesis, QuickCheck, fast-check)
  • Mutation testing scenarios
  • Fuzz testing inputs

3. Multi-Language Support

Support major programming languages:

  • Python, JavaScript/TypeScript, Java, C/C++, Go, Rust, C#, Ruby, PHP, Swift, Kotlin

Edge Case Analysis Workflow

Step 1: Identify Input Domains

Analyze each input parameter or data structure:

For numeric inputs:

- Minimum value (e.g., INT_MIN, 0, -∞)
- Maximum value (e.g., INT_MAX, 255, +∞)
- Zero
- One (unit value)
- Negative one
- Just below/above boundaries
- Overflow/underflow values

For collections (arrays, lists, sets):

- Empty collection
- Single element
- Two elements (minimal interaction)
- Maximum size (if bounded)
- All identical elements
- All unique elements
- Sorted vs unsorted
- Contains duplicates

For strings:

- Empty string ("")
- Single character
- Very long string (10K+ chars)
- Unicode characters (emoji, RTL, special)
- Whitespace only ("   ")
- Null terminator issues
- Special characters (\n, \t, \0)

For pointers/references:

- Null/None/undefined
- Dangling pointer
- Self-reference (circular)
- Uninitialized

Step 2: Identify State and Preconditions

Object state:

- Uninitialized state
- Partially initialized
- Valid operational state
- Invalid/corrupted state
- Locked/busy state
- Disposed/freed state

Precondition violations:

- Missing required parameters
- Parameters in wrong order
- Invalid combinations
- Violated invariants

Step 3: Identify Output Scenarios

Success cases:

- Typical successful execution
- Boundary successful case
- Empty result (valid but empty)

Failure cases:

- Expected exceptions/errors
- Timeout scenarios
- Partial failures
- Resource exhaustion

Step 4: Identify Interaction Patterns

Temporal patterns:

- First operation
- Last operation
- Repeated operations
- Alternating operations
- Concurrent operations

Dependency patterns:

- Missing dependencies
- Circular dependencies
- Incompatible versions
- Network failures

Step 5: Generate Test Cases

For each identified edge case, generate:

  1. Test name: Descriptive name indicating the edge case
  2. Setup: Initialize necessary state/fixtures
  3. Input: The specific boundary or edge case input
  4. Expected behavior: What should happen (success, specific exception, etc.)
  5. Assertions: Verify the expected behavior
  6. Cleanup: Restore state if necessary

Edge Case Categories

Category 1: Numeric Boundaries

# Example: Testing a function that calculates factorial
def test_factorial_edge_cases():
    # Zero (boundary)
    assert factorial(0) == 1

    # One (boundary)
    assert factorial(1) == 1

    # Negative (invalid input)
    with pytest.raises(ValueError):
        factorial(-1)

    # Large value (overflow risk)
    with pytest.raises(OverflowError):
        factorial(10000)

    # Non-integer (type boundary)
    with pytest.raises(TypeError):
        factorial(3.5)

Category 2: Collection Boundaries

// Example: Testing an array processing function
describe('processArray edge cases', () => {
  test('empty array', () => {
    expect(processArray([])).toEqual([]);
  });

  test('single element', () => {
    expect(processArray([1])).toEqual([1]);
  });

  test('null input', () => {
    expect(() => processArray(null)).toThrow(TypeError);
  });

  test('undefined input', () => {
    expect(() => processArray(undefined)).toThrow(TypeError);
  });

  test('all identical elements', () => {
    expect(processArray([5, 5, 5, 5])).toEqual([5, 5, 5, 5]);
  });

  test('very large array', () => {
    const largeArray = new Array(1000000).fill(1);
    expect(() => processArray(largeArray)).not.toThrow();
  });
});

Category 3: String Boundaries

// Example: Testing string validation
@Test
public void testValidateString_EdgeCases() {
    // Empty string
    assertThrows(ValidationException.class, () -> validateString(""));

    // Null
    assertThrows(NullPointerException.class, () -> validateString(null));

    // Single character
    assertTrue(validateString("a"));

    // Whitespace only
    assertFalse(validateString("   "));

    // Special characters
    assertTrue(validateString("hello@world!"));

    // Unicode
    assertTrue(validateString("你好世界"));

    // Very long string
    String longString = "a".repeat(100000);
    assertDoesNotThrow(() -> validateString(longString));

    // Control characters
    assertFalse(validateString("hello\0world"));
}

Category 4: Pointer/Reference Boundaries

// Example: Testing pointer operations
void test_pointer_edge_cases() {
    // Null pointer
    assert(safe_strlen(NULL) == -1);

    // Empty string
    assert(safe_strlen("") == 0);

    // Single character
    assert(safe_strlen("a") == 1);

    // Very long string
    char long_str[10000];
    memset(long_str, 'a', 9999);
    long_str[9999] = '\0';
    assert(safe_strlen(long_str) == 9999);
}

Category 5: Concurrency Edge Cases

// Example: Testing concurrent access
func TestConcurrentAccess(t *testing.T) {
    cache := NewCache()

    // Race condition: multiple concurrent writes
    t.Run("concurrent writes", func(t *testing.T) {
        var wg sync.WaitGroup
        for i := 0; i < 100; i++ {
            wg.Add(1)
            go func(val int) {
                defer wg.Done()
                cache.Set("key", val)
            }(i)
        }
        wg.Wait()
        // Verify cache is in valid state
        _, ok := cache.Get("key")
        assert.True(t, ok)
    })

    // Deadlock scenario
    t.Run("potential deadlock", func(t *testing.T) {
        done := make(chan bool)
        go func() {
            cache.Set("key1", 1)
            cache.Set("key2", 2)
            done <- true
        }()

        select {
        case <-done:
            // Success
        case <-time.After(5 * time.Second):
            t.Fatal("Deadlock detected")
        }
    })
}

Category 6: State Transition Edge Cases

# Example: Testing state machine
def test_state_machine_edge_cases():
    machine = StateMachine()

    # Invalid initial transition
    with pytest.raises(InvalidStateError):
        machine.stop()  # Can't stop before starting

    # Double start
    machine.start()
    with pytest.raises(InvalidStateError):
        machine.start()  # Already started

    # Transition from error state
    machine.trigger_error()
    with pytest.raises(InvalidStateError):
        machine.resume()  # Can't resume from error

    # Valid state sequence
    machine.reset()
    machine.start()
    machine.pause()
    machine.resume()
    machine.stop()
    assert machine.state == "stopped"

Category 7: Resource Limit Edge Cases

# Example: Testing memory and resource limits
def test_resource_limits()
Compartilhar X LinkedIn