Run Tests
Run pgschema automated tests (go test) to validate diff logic, plan generation, and dump functionality using test fixtures
Security Assessment
Detected risks:
About Run Tests
The Run Tests skill executes automated test suites for pgschema to validate schema diff logic, migration plan generation, dump functionality, and complete migration workflows. It helps ensure that implementation changes behave as expected by running structured Go tests across multiple components of the system. This skill addresses the need for reliable regression validation when modifying schema object support, adjusting diff behavior, updating dump logic, or troubleshooting failing test cases. By providing clearly defined test categories and commands, it enables consistent validation of schema comparison and migration behavior.
The skill supports three primary test categories: fast diff tests that require no live database, integration tests that validate plan and apply workflows using embedded PostgreSQL, and dump tests that verify schema extraction and introspection logic. It also enables scoped testing using the PGSCHEMA_TEST_FILTER environment variable, allowing developers to run specific subsets of tests such as views, triggers, tables, policies, or complex migrations. Additionally, it supports regenerating expected outputs when intentional changes modify generated DDL, using a generation flag to overwrite expected.sql files. These capabilities provide both granular and end-to-end validation options.
This skill is intended for developers working on pgschema who need to validate implementation changes before committing code, debug failures, add new test cases, or confirm compatibility across PostgreSQL versions. It is especially useful during feature development, bug fixes in diff or plan logic, and schema migration improvements. By organizing tests into logical categories and workflows, it helps maintain correctness, stability, and consistency across schema management operations.
FAQ
When should I use the Run Tests skill?
Use it after implementing new schema object support, fixing diff or plan generation bugs, modifying dump logic, debugging test failures, regenerating expected outputs, adding new test cases, or validating changes across PostgreSQL versions.
What is the difference between diff tests and integration tests?
Diff tests validate schema comparison logic using SQL files and do not require a live database. Integration tests create a test database with embedded PostgreSQL, apply schemas, generate plans, execute them, and verify the final state.
How can I run only a specific subset of tests?
Set the PGSCHEMA_TEST_FILTER environment variable with the desired test path and run the appropriate go test command. This allows scoped execution of specific feature or directory-based test cases.
How do I regenerate expected test outputs after intentional changes?
Run the integration test command with the generation flag. This executes the test and overwrites the corresponding expected.sql file with the newly generated output.
Are there performance differences between test categories?
Yes. Diff tests are very fast and do not require a database. Dump tests have medium execution time. Full plan and apply integration tests are slower because they use embedded PostgreSQL and perform end-to-end validation.
Install Run Tests
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
pgschema/pgschema