Skip to content

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 NameTypeRequiredLength/RangeDescription
targetenumYes-Task Type Identifier
Fixed value: JDBC
namestringYes≤400 charsTask Unique Identifier
Example: User Data Query
descriptionstringNo≤800 charsTask Detailed Description
Describes task purpose and execution content
enabledbooleanYes-Enable Status
true: Execute task (default)
false: Skip task
beforeNamestringNo≤400 charsPredecessor Task Name
Controls task execution order
When empty, uses previous task in pipeline
transactionNamestringNo≤400 charsTransaction Name
Associated transaction controller name
Required for elements in transaction
typeenumYes-SQL Operation Type
SELECT: Query
UPDATE: Update
CALLABLE: Stored Procedure
PREPARED_SELECT: Prepared Query
PREPARED_UPDATE: Prepared Update
sqlstringYes≤8192 charsSQL Statement
Supports variables and Mock functions
Note: Only single SQL statement supported
Example: SELECT * FROM users WHERE id = {userId}
maxResultRowsintegerNo1-10000Max Result Rows
Limits returned rows (default: 1000)
Excess rows are ignored
timeoutInSecondintegerNo1-7200Execution Timeout (seconds)
Default: No timeout
Production environment recommended ≤30 seconds
argumentsarray[object]No-Prepared Parameters
Required for PREPARED_* types
Format: {name, type, value}
assertionsarray[object]No-Result Assertions
Supports: BODY content matching, SIZE row count validation, DURATION execution time
Reference Http Assertion Docs
variablesarray[object]No-Result Variable Extraction
Extracts variables from query results
Reference "Parameterization - Sample Extraction"
View Variable Definition
datasetsarray[object]No-Test Datasets
Drives parameterized testing
Supports CSV/JSON formats
Reference "Parameterization - Datasets"
View Dataset Definition
actionOnEOFenumNo-Dataset End Policy
RECYCLE: Recycle (default)
STOP_THREAD: Stop thread
sharingModeenumNo-Data Sharing Mode
ALL_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)

TypeSQL Statement TypeUsage ScenarioCharacteristics
SELECTStandard QuerySimple data retrieval
No parameterization needed
Direct execution
Result set processing
UPDATEData ModificationData insert/update/delete
Table structure changes
Returns affected rows
Auto-commit
CALLABLEStored ProcedureExecutes business logic
Handles complex operations
Supports IN/OUT parameters
Returns multiple result sets
PREPARED_SELECTPrepared QueryOptimized repeated queries
Secure parameterization
Prevents SQL injection
Execution plan reuse
PREPARED_UPDATEPrepared UpdateBatch 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 NameTypeRequiredLength LimitDescription
typestringNo≤80 charsParameter Data Type
Supports: INTEGER, DECIMAL, DOUBLE, CHAR, VARCHAR, DATE, TIMESTAMP
Default: VARCHAR
inoutenumYes-Parameter Direction
IN: Input parameter
OUT: Output parameter
INOUT: Input/Output parameter
valuestringYes-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 = ?
    yaml
    arguments:
      - 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)
    yaml
    arguments:
      - 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))
    yaml
    arguments:
      - 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

Released under the GPL-3.0 License.