Skip to content
Skills Library
Programming · Testing

dbaitest-add-test

/dbaitest-add-test

Adds more database integration tests to a repository that already has a DbAiTest (MSTest) test project. It finds that project, reads how it is wired (the abstract test class, the class per engine, where the schema comes from), and writes tests for the procedures, functions, views and tables the user picks, reusing the harness the project already has. Use when the user wants more database tests, wants to cover a procedure, function, view or table that has no test yet, or asks to extend an existing DbAiTest test suite.

Licence
MIT
Last repository change
13.11.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
6
Scripts
2
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 13.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • 2 scripts in this package. Review them before installing, as Claude may execute them.

Scripts: scripts/locate-tests.mjs, scripts/test-project-signals.mjs

What it does and when to use it

Adds more database integration tests to a repository that already has a DbAiTest (MSTest) test project. It finds that project, reads how it is wired (the abstract test class, the class per engine, where the schema comes from), and writes tests for the procedures, functions, views and tables the user picks, reusing the harness the project already has. Use when the user wants more database tests, wants to cover a procedure, function, view or table that has no test yet, or asks to extend an existing DbAiTest test suite.

Original author description

Adds more database integration tests to a repository that already has a DbAiTest (MSTest) test project. It finds that project, reads how it is wired (the abstract test class, the class per engine, where the schema comes from), and writes tests for the procedures, functions, views and tables the user picks, reusing the harness the project already has. Use when the user wants more database tests, wants to cover a procedure, function, view or table that has no test yet, or asks to extend an existing DbAiTest test suite.

How it works

  1. 1. Preflight
  2. 2. Locate the test project
  3. 3. Read the project
  4. 4. Propose what to test next
  5. 5. Write the tests
  6. 6. Run
  7. 7. Report
  8. Rules
Original SKILL.md headings · 125 lines, 1,013 words
SKILL.md preview
---
name: dbaitest-add-test
description: Adds more database integration tests to a repository that already has a DbAiTest (MSTest) test project. It finds that project, reads how it is wired (the abstract test class, the class per engine, where the schema comes from), and writes tests for the procedures, functions, views and tables the user picks, reusing the harness the project already has. Use when the user wants more database tests, wants to cover a procedure, function, view or table that has no test yet, or asks to extend an existing DbAiTest test suite.
license: MIT
compatibility: Needs Node.js 20+, the .NET SDK (8 or 10) and a running Docker engine.
metadata:
  dbaitest-version: "0.4.0"
  source: "@dbaitest/skills"
---

# More tests for a project that already has them

Adds tests to the DbAiTest test project **the user's repository already has**. The project is
found, read and extended: the new tests go into the class the project already has, so every
engine keeps running them and the harness wiring stays as it is.

This skill never creates a test project (that is `dbaitest-scaffold`'s job) and never diagnoses a
failing test. It adds tests.

Run every command **from the repository root**. `<skill-dir>` is only where the scripts live (the
directory of this `SKILL.md`, for example `.claude/skills/dbaitest-add-test/`). Never write into
the skill directory.

## 1. Preflight

| Check | Command | If it fails |
|---|---|---|
| Node 20+ | `node --version` | Install Node.js 20 or later (the locate script needs it). |
| .NET SDK 8+ | `dotnet --list-sdks` | Install the .NET 8 or 10 SDK. |
| Docker running | `docker info` | Start Docker Desktop / the Docker daemon. Tests cannot run without it. |

## 2. Locate the test project

```bash
node <skill-dir>/scripts/locate-tests.mjs
```

It reads the repository (it never writes or builds) and prints JSON. `references/adding-tests.md`
documents every field. In short:

- `testProjects`: the DbAiTest test projects it found, each with the project file, the framework,
  the DbAiTest packages, `schema` (where the schema comes from), `baseTestClass` (the class the
  tests belong in), `engineClasses` (one per engine), `testMethods` (the tests already there).
- `libraryProjects`: projects that use the DbAiTest libraries but are not test projects. Ignore
  them.
- `truncated`: true when the scan hit its limits and may have missed something. Say so.

Tell the user in two or three lines what you found: which project, which engines, which class the
tests go in.

- One project → use it.
- Several → ask which one.
- None → say that this repository has no DbAiTest test project, that `dbaitest-scaffold` creates
  one, and stop.

## 3. Read the project

Open the files the report names: the base test class, the class per engine, and the schema source.
You need four things before writing a test:

1. **Where the tests go.** The abstract class (`baseTestClass.isAbstract` is true) is shared by
   every engine: put the tests there. A project with one concrete class that creates the engine
   itself (`baseTestClass.isAbstract` is false) takes the tests in that class.
2. **Which engines run them.** `engines` lists them. A test written in the shared class runs on
   every one of them.
3. **Where the schema comes from.** `schema.kind` is `scripts` (a folder of `.sql` files), `dacpac`
   (a database project), `source` (the test class builds a `SchemaSource` itself) or `none`. A
   test that needs a table the schema does not create is a test that cannot pass: check before
   writing it. The folders the harness skips (`engineClasses[].excludedDirectories`, usually
   `seed`) are not in the database either: nothing in them can be tested.
4. **What is already tested.** `testMethods` lists the tests that exist. Do not write a second
   test for the same behaviour.

## 4. Propose what to test next

List the database's objects: from the schema scripts the project links (`schema.includes` points at
them, relative to the project folder), or from `Harness.ListObjectsAsync` in a throwaway test.
Skip the objects that already have a test.

Propose **3 to 5** objects to test next, preferring, in order:

1. procedures and functions the application calls (search the app code for their names);
2. views and functions with business logic (totals, status rules, calculations);
3. tables with constraints that encode rules (`CHECK`, `UNIQUE`, foreign keys, triggers).

Give one line per object: what the test would prove. Ask the user to confirm or change the pick.
If the user already named objects, use those.

## 5. Write the tests

Add the tests to the class from step 3, following `references/adding-tests.md` (where they go, how
to cover an object, the rules of a good test) and `references/engine-calls.md` (how to call a
procedure, a function, a view and a constraint on each engine):

- one behaviour per test, named `Object_Does_What_When`;
- seed with SQL through the harness, then assert through a **second channel** (the row a procedure
  wrote, not only what it returned);
- cover the rule and its edge: the happy path, then one rejection or boundary;
- keep the SQL portable: the shared class runs on every engine the project has. An object that
  exists on one engine only is the user's call — ask, then put that test in that engine's class
  (make the class `partial` first);
- never change the schema, the database project or the harness wiring to make a test pass.

## 6. Run

```bash
dotnet test <project dir>
```

The first run pulls the image and takes minutes. Run it until green. A failing test is fixed in
the test: seed before the assertion, assert through a second channel, keep the test independent
of the other tests. If the schema itself is wrong, say so and ask; do not edit it.

When a test fails and the cause is not obvious, `dbaitest-debug` runs the suite, names the test
and the engine class that failed, and works the cause out.

## 7. Report

Report what each new test proves, which objects are still untested, and anything you could not
test (an object that needs a second engine, a script the schema does not apply).

## Rules

- Add to the class the project already has. Never create a second suite per engine, never a
  second harness, never a copy of the `[TestInitialize]` that cleans the database.
- Never remove `[assembly: DoNotParallelize]`: the tests share one container per engine.
- Never point the harness at a shared, staging or production database; it only uses the
  containers it starts.
- Never change the user's schema files or database project to make a test pass; ask.
- Keep DbAiTest packages at the version this skill pins (`metadata.dbaitest-version`) unless the
  user asks to upgrade.
- The shape guard fails a test that changes a shared table: restore what you changed, or create
  your own table. `references/adding-tests.md` has the details.
Files in this package (6)
  • SKILL.md 7 KB
  • versions.json 1 KB
  • references/adding-tests.md 9 KB
  • references/engine-calls.md 7 KB
  • scripts/locate-tests.mjs 6 KB
  • scripts/test-project-signals.mjs 9 KB

Versions

The database has no other skills named dbaitest-add-test.

Database snapshot: 13.11.2026 · package version 5a53c78bc346 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 1 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100dbaitest-scaffold
    Adds a .NET database integration test project to the user's repository on DbAiTest (MSTest), with tests that run against a real SQL Server, PostgreSQL or MySQL in a throwaway Docker container. It first finds the database the repository already has (an SDK-style .sqlproj /…
  • 100dbaitest-debug
    Diagnoses a failing DbAiTest (MSTest) test in a repository that already has a DbAiTest test project. It runs the suite, reads the result file, names the test and the engine class that failed, and works out the cause — the test's own assertion, the SQL it ran, the shape guard, a…
  • 100scaffold-dotnet-test-project
    MUST USE when an existing .NET test project was excluded from a .slnf/CI solution filter, disappeared from .sln/.slnx discovery, or lost its production ProjectReference; also for requests to set up, create, reuse, add, register, include, or repair a test project. Handles "tests…
  • 100backend-test
    Generate backend tests (unit, integration, mocks) for existing code. Auto-invoke when user says "write test for", "add test", "test this", or "create test".
  • 100test-generator
    Write unit and integration tests for existing code, covering the happy path, edge cases, error paths and boundary values, using the project's own test framework and style. Use when the user asks to add tests, raise coverage, write test cases for a function, module or endpoint, or test a bug fix.
  • 100write-tests
    Write unit and integration tests. Use when the user says "write tests for this", "add test coverage", "how do I test this", "TDD", "red green refactor", "unit test this function", "test this module", "I need tests for", or has code that lacks tests - even if they don't explicitly say "write tests".

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.