JDBC Test Task
The
JDBC Test Task
defines a JDBC protocol testing task for functional, performance, stability, and custom testing of JDBC operations.
Main Parameter List
Field Name | Type | Required | Length/Range | Description |
---|---|---|---|---|
target | enum | Yes | - | Task Type Identifier Fixed value: JDBC |
name | string | Yes | ≤400 chars | Task Unique Identifier Example: User Data Query |
description | string | No | ≤800 chars | Task Detailed Description Describes task purpose and execution content |
enabled | boolean | Yes | - | Enable Statustrue : Execute task (default)false : Skip task |
beforeName | string | No | ≤400 chars | Predecessor Task Name Controls task execution order When empty, uses previous task in pipeline |
transactionName | string | No | ≤400 chars | Transaction Name Associated transaction controller name Required for elements in transaction |
type | enum | Yes | - | SQL Operation TypeSELECT : QueryUPDATE : UpdateCALLABLE : Stored ProcedurePREPARED_SELECT : Prepared QueryPREPARED_UPDATE : Prepared Update |
sql | string | Yes | ≤8192 chars | SQL Statement Supports variables and Mock functions Note: Only single SQL statement supported Example: SELECT * FROM users WHERE id = {userId} |
maxResultRows | integer | No | 1-10000 | Max Result Rows Limits returned rows (default: 1000) Excess rows are ignored |
timeoutInSecond | integer | No | 1-7200 | Execution Timeout (seconds) Default: No timeout Production environment recommended ≤30 seconds |
arguments | array[object] | No | - | Prepared Parameters Required for PREPARED_* typesFormat: {name, type, value} |
assertions | array[object] | No | - | Result Assertions Supports: BODY content matching, SIZE row count validation, DURATION execution timeReference Http Assertion Docs |
variables | array[object] | No | - | Result Variable Extraction Extracts variables from query results Reference "Parameterization - Sample Extraction" View Variable Definition |
datasets | array[object] | No | - | Test Datasets Drives parameterized testing Supports CSV/JSON formats Reference "Parameterization - Datasets" View Dataset Definition |
actionOnEOF | enum | No | - | Dataset End PolicyRECYCLE : Recycle (default)STOP_THREAD : Stop thread |
sharingMode | enum | No | - | Data Sharing ModeALL_THREAD : Thread-shared (default)CURRENT_THREAD : Thread-independent copy |
Complete structure example:
yaml
- target: JDBC
name: queryUser
description: Query user by select statement
enabled: true
beforeName: BusinessTransaction
transactionName: BusinessTransaction
sql: SELECT * FROM {table} WHERE username = ?;
arguments:
# Prepared parameters ...
assertions:
# Assertion parameters ...
variables:
# Variable parameters ...
datasets:
# Dataset parameters ...
actionOnEOF: RECYCLE
sharingMode: ALL_THREAD
Query Parameter Types (type)
Type | SQL Statement Type | Usage Scenario | Characteristics |
---|---|---|---|
SELECT | Standard Query | Simple data retrieval No parameterization needed | Direct execution Result set processing |
UPDATE | Data Modification | Data insert/update/delete Table structure changes | Returns affected rows Auto-commit |
CALLABLE | Stored Procedure | Executes business logic Handles complex operations | Supports IN/OUT parameters Returns multiple result sets |
PREPARED_SELECT | Prepared Query | Optimized repeated queries Secure parameterization | Prevents SQL injection Execution plan reuse |
PREPARED_UPDATE | Prepared Update | Batch data operations Secure updates | Efficient execution Type-safe parameters |
Input/Output Parameters (arguments)
Input/Output Parameters
configure parameter information for prepared SQL, stored procedures, or functions.
Notes
Prepared statements, stored procedures, or functions must have consistent parameter types in quantity and order.
If types are unspecified, they will be treated as VARCHAR.
Field Name | Type | Required | Length Limit | Description |
---|---|---|---|---|
type | string | No | ≤80 chars | Parameter Data Type Supports: INTEGER , DECIMAL , DOUBLE , CHAR , VARCHAR , DATE , TIMESTAMP Default: VARCHAR |
inout | enum | Yes | - | Parameter DirectionIN : Input parameterOUT : Output parameterINOUT : Input/Output parameter |
value | string | Yes | - | Parameter Value Supports constants, variable expressions Example: 123 , {userId} , NOW() |
Input/Output Parameter Types (inout):
1. IN Parameter (Input)
- Purpose: Pass input values to SQL
- Characteristics:
- Input only
- Value determined before call
- Stored procedures cannot modify its value
- Example:sql
-- SQL SELECT * FROM users WHERE id = ?
yamlarguments: - type: "INTEGER" inout: "IN" value: "1001"
2. OUT Parameter (Output)
- Purpose: Return result values from SQL
- Characteristics:
- Output only
- No pre-call assignment needed
- Stored procedure sets its value
- Example:sql
-- Stored Procedure CREATE PROCEDURE get_count(OUT user_count INT)
yamlarguments: - type: "INTEGER" inout: "OUT" value: "" # Output result receiver
3. INOUT Parameter (Input/Output)
- Purpose: Bidirectional data transfer
- Characteristics:
- Both input and output
- Requires initial value before call
- Stored procedure can modify its value
- Example:sql
-- Stored Procedure CREATE PROCEDURE update_balance(INOUT balance DECIMAL(10,2))
yamlarguments: - type: "DECIMAL" inout: "INOUT" value: "1000.00"
Script Examples (target)
Query Statement Example
yaml
- target: JDBC
name: QueryUser
description: Query user by select statement
enabled: true
type: SELECT
sql: SELECT * FROM `user` WHERE username = 'JohnDoe'
maxResultRows: 2
timeoutInSecond: 60
Update Statement Example
yaml
- target: JDBC
name: UpdateUser
description: Modify user by prepared update statement
enabled: true
type: PREPARED_UPDATE
sql: UPDATE `user` SET password = '@String(32)' WHERE username = 'JohnDoe'
timeoutInSecond: 60
Function Call Example
yaml
- target: JDBC
name: QueryUser
description: Query the number of users by function
enabled: true
type: CALLABLE
sql: "{? = CALL func_count_users_with_name(?)}"
timeoutInSecond: 60
arguments:
- type: integer
inout: OUT
- type: varchar
value: JohnDoe
inout: IN
Stored Procedure Call Example
yaml
- target: JDBC
name: QueryUser
description: Query the number of users by procedure
enabled: true
type: CALLABLE
sql: "{CALL count_users_with_name(?, ?)}"
timeoutInSecond: 60
arguments:
- type: varchar
value: JohnDoe
inout: IN
- type: integer
inout: OUT
Prepared Query Statement Example
yaml
- target: JDBC
name: QueryUser
description: "Query user by prepared select statement, equivalent to static statement \"SELECT * FROM `user` WHERE username = 'JohnDoe'\""
enabled: true
type: PREPARED_SELECT
sql: SELECT COUNT(*) FROM `user` WHERE username = ?
maxResultRows: 1
timeoutInSecond: 60
arguments:
- type: varchar
value: JohnDoe
inout: IN
Prepared Update Statement Example
yaml
- target: JDBC
name: UpdateUser
description: "Modify user by prepared update statement, equivalent to static statement \"UPDATE `user` SET password = 'password123' WHERE username = 'JohnDoe'\""
enabled: true
type: PREPARED_UPDATE
sql: UPDATE `user` SET password = ? WHERE username = ?
timeoutInSecond: 60
arguments:
- type: varchar
value: '@String(32)'
inout: IN
- type: varchar
value: JohnDoe
inout: IN