Basic Concepts
Core rules for writing and running .gctf tests.
What a test contains
php
--- ADDRESS ---
localhost:4770
--- ENDPOINT ---
package.Service/Method
--- REQUEST ---
{
"id": 1
}
--- ASSERTS ---
.id == 1Main sections
META- file-level metadata (name, summary, tags, owner, links); if present, must be the first sectionADDRESS- target host and portENDPOINT- gRPC method inpackage.Service/MethodformatREQUEST- JSON payload (multiple allowed)RESPONSE- expected JSON payload (multiple allowed)ERROR- expected error payloadASSERTS- validation expressionsEXTRACT- extract values for reuse and advanced checksREQUEST_HEADERS- request metadataTLS- TLS/mTLS parametersPROTO- descriptor/reflection configurationOPTIONS- parsed, validated, and used for per-test runtime overrides (timeout,retry,retry-delay,no-retry,compression)
Use Section Reference for exact syntax and section rules.
Required rules
METAis optional, but only one is allowed and it must be firstENDPOINTis required- At least one validation block is required:
RESPONSE,ERROR, orASSERTS RESPONSEandERRORcannot be used in the same test fileADDRESScan be omitted ifGRPCTESTIFY_ADDRESSis set
META example
php
--- META ---
name: Say hello returns greeting
summary: Smoke check for unary hello endpoint
tags: [smoke, hello]
owner: qa-platform
links:
- https://github.com/gripmock/grpctestify-rustRPC patterns
- Unary: one
REQUEST+ oneRESPONSE - Client streaming: multiple
REQUEST+ oneRESPONSE - Server streaming: one
REQUEST+ multipleRESPONSEorASSERTS - Bidirectional streaming: alternating
REQUESTand checks
Assertion examples
php
--- ASSERTS ---
.status == "ok"
@len(.items) > 0
@header("x-request-id") != null
@uuid(.user.id)Inline response options
Use inline options in the section header when matching needs tuning:
php
--- RESPONSE with_asserts partial tolerance=0.1 unordered_arrays ---
{
"price": 9.99,
"tags": ["a", "b"]
}with_asserts- allow additionalASSERTSchecks after payload matchingpartial- allow expected payload to be a subset of actual payloadtolerance- numeric tolerance for floating-point comparisonsunordered_arrays- ignore array element ordering during comparison
Runtime configuration
Use CLI flags for runtime behavior:
bash
grpctestify tests/ --parallel 4 --timeout 30
grpctestify tests/ --log-format json --log-output results.jsonUseful environment variables:
bash
export GRPCTESTIFY_ADDRESS="localhost:4770"
export GRPCTESTIFY_COMPRESSION="gzip"
export GRPCTESTIFY_TLS_CA_FILE="./certs/ca.pem"