assertion-synthesizer

Solid

Generate test assertions from existing code implementation. Use when the user has implementation code without tests or incomplete test coverage, and needs assertions synthesized by analyzing the code's behavior, inputs, outputs, and state changes. Supports Python (pytest/unittest), Java (JUnit/AssertJ), and JavaScript/TypeScript (Jest/Chai). Handles equality checks, collections, exceptions, and state verification.

Testing & QA 160 stars 17 forks Updated today Apache-2.0

Install

View on GitHub

Quality Score: 87/100

Stars 20%
73
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Assertion Synthesizer Generate comprehensive test assertions by analyzing code implementation, behavior, and expected outputs. ## Workflow ### 1. Analyze Code Read and understand the implementation to identify testable behavior: - **Function signatures**: Parameters, return types, side effects - **Logic paths**: Conditionals, loops, branching behavior - **Edge cases**: Boundary conditions, null/empty inputs, error conditions - **State changes**: Object mutations, attribute modifications - **Dependencies**: External calls, database operations, I/O ### 2. Identify Test Scenarios Extract scenarios that need assertions: - **Happy path**: Normal inputs producing expected outputs - **Edge cases**: Empty lists, zero values, boundary conditions - **Error cases**: Invalid inputs, exceptions, error handling - **State verification**: Object state before/after operations - **Collection assertions**: List contents, ordering, membership ### 3. Generate Assertions Create appropriate assertions for each scenario: **Assertion Types:** - **Equality**: `assert result == expected`, `assertEquals(expected, actual)` - **Truthiness**: `assert is_valid`, `assertTrue(condition)` - **Collections**: `assert item in list`, `assertContains(list, item)` - **Exceptions**: `pytest.raises(Exception)`, `assertThrows(Exception)` - **State**: `assert obj.status == "active"`, `assertEquals("active", obj.getStatus())` ### 4. Structure Tests Organize assertions into well-structured test functions: ...

Details

Author
ArabelaTso
Repository
ArabelaTso/Skills-4-SE
Created
6 months ago
Last Updated
today
Language
Python
License
Apache-2.0

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category