TestPrune.Sql
0.3.1
dotnet add package TestPrune.Sql --version 0.3.1
NuGet\Install-Package TestPrune.Sql -Version 0.3.1
<PackageReference Include="TestPrune.Sql" Version="0.3.1" />
<PackageVersion Include="TestPrune.Sql" Version="0.3.1" />
<PackageReference Include="TestPrune.Sql" />
paket add TestPrune.Sql --version 0.3.1
#r "nuget: TestPrune.Sql, 0.3.1"
#:package TestPrune.Sql@0.3.1
#addin nuget:?package=TestPrune.Sql&version=0.3.1
#tool nuget:?package=TestPrune.Sql&version=0.3.1
TestPrune.Sql
Add explicit database shared-state dependencies to a TestPrune symbol graph.
When one symbol writes a table or column and another reads it, the extension
adds a SharedState edge so a writer change selects tests that reach the
reader. A test method is never a writer: rows a test seeds exist only inside that
test, so no reader depends on them. A test that reads a table still depends on its
writers.
dotnet add package TestPrune.Sql
Attribute discovery
Annotate module functions or values, then register AutoSqlExtension with the
host that invokes ITestPruneExtension after indexing:
open TestPrune.Sql
open TestPrune.Extensions
[<WritesTo("public.articles", "status")>]
let markComplete connection articleId =
// ...
[<ReadsFrom("public.articles", "status")>]
let listComplete connection =
// ...
let extension: ITestPruneExtension =
AutoSqlExtension() :> ITestPruneExtension
The one-argument attribute form uses the wildcard column *. A wildcard
matches every column on the same table. Use schema-qualified table identities
such as public.articles when facts must interoperate with
TestPrune.SqlHydra; equal table names in different schemas otherwise cannot
be distinguished.
For facts obtained outside source attributes, construct SqlFact values and
register SqlExtension(facts) instead. Registration is explicit: merely
referencing this package does not run either extension. The host stores their
edges with refreshExtensionEdges on every index build.
Tests with their own database state
When every test starts from its own database state (truncated and re-seeded per test or per fixture), rows a writer stores are visible only to the test that ran the writer. A changed writer can then affect a test that reads its table only if that test also executes the writer. Open the index with the reachability-gated policy to select on that basis:
let db = TestPrune.Database.Database.create (dbPath, SqlCoupling.reachabilityGated)
A writer change then selects a test through a reader only when the test reaches
the writer through its other edges: calls, routes, dispatch, or a fixture that
seeds through it. The stored edges are the same under either policy. Keep the
default (WalkPolicy.FollowAll) when tests share database state, for example rows
written by another test or a seed snapshot built outside any test.
See the repository's integration guide for extension-host wiring and edge direction.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- FSharp.Compiler.Service (>= 43.12.401)
- FSharp.Core (>= 10.1.401)
- Microsoft.Data.Sqlite (>= 10.0.11)
- SQLitePCLRaw.lib.e_sqlite3 (>= 3.53.3)
- TestPrune.Core (>= 13.4.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on TestPrune.Sql:
| Package | Downloads |
|---|---|
|
TestPrune.SqlHydra
SqlHydra integration for TestPrune — automatic SQL coupling detection from typed queries |
GitHub repositories
This package is not used by any popular GitHub repositories.