String Methods (Declarative)
This example shows complete runnable declarative string-method usage in YAML-level expressions.
tolowercase
name: TestPlan
rounds:
- name: FeatureRound
numberOfClients: 1
arrivalDelay: 1000
runInParallel: false
iterations:
- name: users
httpRequest:
capture:
to: users
as: Json
makeGlobal: true
url: https://jsonplaceholder.typicode.com/users
method: GET
- name: lowerCaseCheck
httpRequest:
skipIf: $contains(source=$tolowercase(source=$users.Body[0].name), value=leanne)
httpMethod: Get
url: https://jsonplaceholder.typicode.com/
touppercase
name: TestPlan
rounds:
- name: FeatureRound
numberOfClients: 1
arrivalDelay: 1000
runInParallel: false
iterations:
- name: users
httpRequest:
capture:
to: users
as: Json
makeGlobal: true
url: https://jsonplaceholder.typicode.com/users
method: GET
- name: upperCaseCheck
httpRequest:
skipIf: $contains(source=$touppercase(source=$users.Body[9].name), value=CLEMENTINA)
httpMethod: Get
url: https://jsonplaceholder.typicode.com/
contains
name: TestPlan
rounds:
- name: FeatureRound
numberOfClients: 1
arrivalDelay: 1000
runInParallel: false
iterations:
- name: users
httpRequest:
capture:
to: users
as: Json
makeGlobal: true
url: https://jsonplaceholder.typicode.com/users
method: GET
- name: containsCheck
httpRequest:
skipIf: $contains(source=$users.Body[0].name, value=graham, ignoreCase=true)
httpMethod: Get
url: https://jsonplaceholder.typicode.com/
startswith
name: TestPlan
rounds:
- name: FeatureRound
numberOfClients: 1
arrivalDelay: 1000
runInParallel: false
iterations:
- name: users
httpRequest:
capture:
to: users
as: Json
makeGlobal: true
url: https://jsonplaceholder.typicode.com/users
method: GET
- name: startsWithCheck
httpRequest:
skipIf: $startswith(source=$users.Body[9].name, value=Clementina)
httpMethod: Get
url: https://jsonplaceholder.typicode.com/
endswith
name: TestPlan
rounds:
- name: FeatureRound
numberOfClients: 1
arrivalDelay: 1000
runInParallel: false
iterations:
- name: users
httpRequest:
capture:
to: users
as: Json
makeGlobal: true
url: https://jsonplaceholder.typicode.com/users
method: GET
- name: endsWithCheck
httpRequest:
skipIf: $endswith(source=$users.Body[0].email, value=.BIZ, ignoreCase=true)
httpMethod: Get
url: https://jsonplaceholder.typicode.com/
Notes
- Declarative methods run at YAML level and do not require C# string-literal quoting.
contains,startswith, andendswithsupportignoreCase=true.- You can use
source=as a named argument or as the first positional argument.