بنقرة واحدة
frl-test-coding-standard
Standards for writing tests in fdb-record-layer. Apply when writing or reviewing test code.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Standards for writing tests in fdb-record-layer. Apply when writing or reviewing test code.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Write or update documentation in docs/sphinx/source/. Applies the appropriate style for user-facing vs. architecture docs.
Code review the current branch for adherence to project standards, correctness, and best practices.
Simplifies and refines recently modified code for clarity, consistency, and maintainability while preserving all functionality.
Rebuild working context after a session restart. Reads branch state, recent commits, open PRs, and changed files to produce a "what was I doing" summary.
Coding standards for all Java code in fdb-record-layer. Apply when writing or reviewing any Java code.
Specialized skill for working in the fdb-relational-core SQL processing layer — parser, plan generator, and Cascades planner. Use when debugging query plans, writing planner rules, or understanding the SQL execution path.
Always apply the frl-coding-standard skill in addition to the standards below.
| What you're testing | Preferred approach |
|---|---|
| SQL query behavior, query plans, result sets | yaml-tests (.yamsql file) |
| JDBC-level interactions | JUnit test in fdb-relational-jdbc or fdb-relational-core |
| Record layer API (below SQL) | JUnit test |
| Async / CompletableFuture edge cases | JUnit test |
| Index maintenance, key expression logic | JUnit test |
When in doubt, prefer yaml-tests for anything reachable through SQL.
yaml-tests/src/test/resources/<feature>-tests.yamsql.yaml-tests/src/test/java/YamlIntegrationTests.java with a @YamlTest
annotated method:
@YamlTest(schemaTemplateFiles = {}, queryFiles = "my-feature-tests.yamsql")
void myFeatureTests(YamlTest.Runner runner) throws Exception {
runner.runYamsql();
}
@MaintainYamlTestConfig(YamlTestConfigFilters.CORRECT_EXPECTATIONS) to
have the framework auto-populate expected query plans, metrics, and metadata on first run.
Remove the annotation once the expected values are stable and reviewed.See yaml-tests/src/test/resources/showcasing-tests.yamsql for a full reference.
Key building blocks:
options:
supported_version: 1.0.0 # minimum FRL version required
schema_template: # declarative schema — reused across test blocks
create table t (id bigint, name string, primary key(id))
setup: # DML run once before the test block
- query: insert into t values (1, 'Alice'), (2, 'Bob')
test_block:
preset: single_repetition_ordered
tests:
- query: select * from t where id = 1
result:
- [1, Alice]
- query: explain select * from t where id = 1
explain: "COVERING(...)" # auto-filled by CORRECT_EXPECTATIONS on first run
Common result matchers: !ignore, !l (Long literal), !null, !not_null,
!sc <substring> (string contains), !pos <value> (positional).
Add @DebugPlanner to the test method to launch PlannerRepl and inspect the plan
interactively.
junit.framework or org.junit.Assert (checkstyle-banned).org.assertj.core.api.Assertions).<methodUnderTest><Condition><ExpectedResult>.@BeforeEach or helper methods; DRY up after writing.Thread.sleep() to wait for async operations — use asyncToSync() or
CompletableFuture composition.join() or get() directly in test code if asyncToSync() is available on
the context — it gives better error messages and timeout behavior.