Test File Format
Specification of .gctf files for the Rust CLI.
Minimal Example
php
--- ADDRESS ---
localhost:4770
--- ENDPOINT ---
package.Service/Method
--- REQUEST ---
{
"id": 1
}
--- ASSERTS ---
.id == 1Supported Sections
ADDRESS- server address (host:port)ENDPOINT- gRPC method (package.Service/Method)REQUEST- JSON payload (multiple allowed)RESPONSE- expected JSON (multiple allowed)ERROR- expected error JSON/stringASSERTS- assertion expressions (multiple allowed)EXTRACT- variable extraction rules (multiple allowed)REQUEST_HEADERS(orHEADERS) - request metadataTLS- TLS/mTLS configPROTO- descriptor/reflection configurationOPTIONS- parsed, validated, and applied for per-test runtime overrides (timeout,retry,retry-delay,no-retry)
Validation Rules
ENDPOINTis required- At least one of
RESPONSE,ERROR, orASSERTSis required RESPONSEandERRORcannot be used together in one fileADDRESSmay be omitted ifGRPCTESTIFY_ADDRESSis set
RESPONSE Inline Options
Inline options use key=value in the section header:
php
--- RESPONSE with_asserts=true partial=true tolerance=0.1 unordered_arrays=true ---
{
"status": "ok"
}Supported options for RESPONSE:
with_asserts=true|falsepartial=true|falsetolerance=<number>redact=["field1","field2"]unordered_arrays=true|false
ERROR supports only with_asserts=true|false.
TLS Section
php
--- TLS ---
ca_cert: ./certs/ca.pem
cert: ./certs/client.pem
key: ./certs/client-key.pem
server_name: api.example.com
insecure: falseSupported keys include:
ca_certorca_filecert,client_cert, orcert_filekey,client_key, orkey_fileserver_nameinsecure
PROTO Section
php
--- PROTO ---
descriptor: ./descriptors/api.descNotes:
- Native mode supports
descriptor=<path>and server reflection PROTO files=...is currently not supported in native mode
Assertion Plugins
Examples of built-in plugins:
php
--- ASSERTS ---
@header("x-request-id") != null
@uuid(.user.id, "v4")
@email(.user.email)See also: Assertions, Type Validation.