String Methods (Flee Expressions)

This example shows complete runnable plans for Flee string expressions.

In Flee, skipIf is evaluated as a C# expression, so string comparisons and string-method calls should use quoted string values.

Important: Flee methods vs Declarative methods

  • Use ${...} around LPS variables when building Flee expressions.
  • The braces identify where LPS variable parsing starts and ends before Flee evaluates the expression.
  • If braces are omitted, LPS may read method calls like .ToUpper() as part of the variable path because . is not treated as a stop character for variable parsing.
  • That causes the variable lookup to fail and can produce empty values.
  • Declarative methods are different and use YAML-level functions such as $touppercase(...), $contains(...), and $startswith(...).

Flee with QJson

QJson is valid with Flee. Keep the LPS variable inside ${...}, then call the Flee string method.


name: TestPlan
rounds:
  - name: FeatureRound
    numberOfClients: 1
    arrivalDelay: 1000
    runInParallel: false

    iterations:
      - name: usersQ
        httpRequest:
          capture:
            to: usersQ
            as: QJson
            makeGlobal: true
          url: https://jsonplaceholder.typicode.com/users
          method: GET

      - name: fleeUpperCheck
        httpRequest:
          skipIf: '${usersQ.Body[0].name}.ToUpper() = "LEANNE GRAHAM"'
          httpMethod: GET
          url: https://jsonplaceholder.typicode.com/

      - name: fleeContainsCheck
        httpRequest:
          skipIf: '${usersQ.Body[0].name}.Contains("Graham")'
          httpMethod: GET
          url: https://jsonplaceholder.typicode.com/

      - name: fleeStartsWithCheck
        httpRequest:
          skipIf: '${usersQ.Body[9].name}.StartsWith("Clementina")'
          httpMethod: GET
          url: https://jsonplaceholder.typicode.com/

      - name: fleeEndsWithCheck
        httpRequest:
          skipIf: '${usersQ.Body[0].email}.EndsWith(".biz")'
          httpMethod: GET
          url: https://jsonplaceholder.typicode.com/
                                                                

Flee with Json + explicit placeholder quoting

If capture is Json (not QJson), manually quote the resolved value and still keep ${...} around the LPS variable.


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: fleeUpperCheck
        httpRequest:
          skipIf: '"${users.Body[0].name}".ToUpper() = "LEANNE GRAHAM"'
          httpMethod: GET
          url: https://jsonplaceholder.typicode.com/

      - name: fleeContainsCheck
        httpRequest:
          skipIf: '"${users.Body[0].name}".Contains("Graham")'
          httpMethod: GET
          url: https://jsonplaceholder.typicode.com/

      - name: fleeStartsWithCheck
        httpRequest:
          skipIf: '"${users.Body[9].name}".StartsWith("Clementina")'
          httpMethod: GET
          url: https://jsonplaceholder.typicode.com/

      - name: fleeEndsWithCheck
        httpRequest:
          skipIf: '"${users.Body[0].email}".EndsWith(".biz")'
          httpMethod: GET
          url: https://jsonplaceholder.typicode.com/

Delimiter Rule (Critical)

Always wrap LPS variables with ${...} inside Flee expressions when calling C# methods.

  • Correct: ${usersQ.Body[0].name}.ToUpper()
  • Incorrect: $usersQ.Body[0].name.ToUpper()

Why: . is not a stop token for LPS variable parsing. Without ${...}, parser can treat method suffixes like .ToUpper() as part of the variable path and resolve an empty value.

Notes

  • In Flee, compared string values should be quoted, for example "LEANNE GRAHAM".
  • To differentiate Flee method calls from declarative methods, use ${...} to mark the exact LPS variable boundary before chaining C# string methods.
  • For Json capture, manually quote placeholders, for example "${users.Body[0].name}".ToUpper().
  • For QJson capture, ${...} is still required to avoid parser overreach when appending methods.
  • For declarative methods examples, see String Methods (Declarative).