# sqlness **Repository Path**: ceres-db/sqlness ## Basic Information - **Project Name**: sqlness - **Description**: An ergonomic, opinionated framework for SQL integration test. - **Primary Language**: Rust - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-02-13 - **Last Updated**: 2023-02-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # sqlness [](https://crates.io/crates/sqlness) [](https://docs.rs/sqlness)  [](https://github.com/CeresDB/sqlness/actions/workflows/ci.yml) [](https://github.com/CeresDB/sqlness/issues) **SQL** integration test har**NESS** An ergonomic, opinionated framework for SQL integration test. # Example See [basic.rs](examples/basic.rs) to learn how to setup a basic test. This is the directory structure of examples ``` $ tree examples/ examples/ ├── basic-case # Testcase root directory │ └── simple # One environment │ ├── config.toml # Config file for current environment, optional │ ├── select.result # Output result file │ └── select.sql # Input SQL testcase ├── basic.rs # Entrypoint of this example ``` When run it via ```bash cargo run --example basic ``` It will do following things: 1. Collect all environments(first-level directory) under `basic-case`. 2. Run tests(`.sql` files) under environment one after one. 1. Before execution it will read `{testcase}.result`(create one if not exists) to memory for compare. 2. During execution it will collect query response and write to `{testcase}.result` 3. After execution it will compare the generated `{testcase}.result` with previous one, **PASS** when they are the same, and **FAIL** otherwise. 3. Report result. Usually `result` files should be tracked in git, whenever there are failed tests, users should 1. Update `result` to latest version(e.g. `git add`) if the newer result is right, or 2. Restore `result` back to original version (e.g. `git checkout`), troubleshoot bugs in database implementation, and run tests again Flowchart below illustrates the typical steps when write a test.