The Expression Builder in Functionize enables you to add logic and dynamic data to your test cases. By using Variables and the fze object, you can capture values during runtime, reuse them across steps or projects, and even generate data dynamically. This allows tests to adapt to changing conditions and scale far beyond static, scripted test cases.
Quick Reference
| Category | Function / Variable | What It Does | Example |
| Expressions | {{ ... }} | Executes inline JavaScript during runtime | {{console.log("Hello")}} |
| Local Variable | fze.local.name | Stores values only for current test execution | fze.local.token = "abc123" |
| Project Variable | fze.project.name | Persists values across all tests in a project | fze.project.env = "staging" |
| TDM Variable | fze.tdm.name | Pulls values from Test Data Management datasets | {{fze.tdm.customerId}} |
| Action Data | fze.action(id).attribute | Captures values from prior test steps (URL, text, etc.) | fze.action("12345").url |
| Cookie Variable | fze.cookie(name).value | Reads cookies (session ID, tokens) | fze.cookie("session-id").value |
| Clipboard Variable | fze.clipboard() | Captures clipboard contents | fze.local.clip = fze.clipboard() |
| Resource Variable | fze.resource[url].attribute | Reads API/network request or response data | fze.resource["/login"].statusCode |
| Page Variable | document.title | Gets current page title | fze.local.title = document.title |
| HTML Storage | localStorage.getItem("key") | Reads browser Local Storage | fze.local.token = localStorage.getItem("auth") |
| Random Data | fze.randomPhone("###-###-####") | Generates phone number | fze.local.phone = fze.randomPhone() |
fze.randomNumber(5) | Generates random number of length n | fze.local.zip = fze.randomNumber(5) | |
fze.randomString(8) | Random alphanumeric string | fze.local.pass = fze.randomString(8) | |
fze.randomEmail("domain.com") | Creates random email | fze.local.email = fze.randomEmail("test.com") | |
fze.randomDoB(1970, 2000) | Random date of birth in range | fze.local.dob = fze.randomDoB(1980, 1990) | |
| Operators | .SubString(start, len) | Extracts part of a string | fze.local.zip.SubString(0, 3) |
.ToLowerCase() | Converts to lowercase | fze.local.name.ToLowerCase() | |
.ToUpperCase() | Converts to uppercase | fze.local.name.ToUpperCase() | |
.ExtractNumbers() | Extracts digits from text | "Order123".ExtractNumbers() → 123 | |
.ExtractFloat() | Extracts decimals | "Price: 19.99".ExtractFloat() → 19.99 | |
.Regex(pattern) | Captures values via regex | "Order#456".Regex("\\d+") → 456 |
Top 5 Practical Scenarios
1. Capturing and Reusing a Login Token
Goal: Store an authentication token from Local Storage after login and reuse it in later test steps or API calls.
// Capture login token
fze.local.authToken = localStorage.getItem("auth_token");
// Reuse in header for API request
fze.resource["/secureEndpoint"].headers.Authorization = "Bearer " + fze.local.authToken;2. Generating Unique Test Users
Goal: Create dynamic, random user accounts for signup tests without collisions.
fze.local.email = fze.randomEmail("test.com");
fze.local.password = fze.randomString(12);
This is useful when running multiple parallel test executions that require unique credentials.
3. Validating a Page Flow with Verifications
Goal: Ensure checkout leads to a confirmation page with a unique order number.
// Capture order ID text
fze.local.orderId = fze.action("orderConfirmationStep").innerText;
// Verify format with regex
fze.local.orderId.Regex("\\d{6}");This confirms the test didn’t just click through—it validated actual business logic.
4. Testing API Response Codes
Goal: Verify backend API responses in the middle of a UI flow.
// Capture status code
fze.local.status = fze.resource["/api/checkout"].statusCode;
// Verify response
fze.local.status == 200;Great for end-to-end tests spanning UI + API.
5. Extracting and Formatting Data for Assertions
Goal: Grab the price displayed on a page and confirm it matches expected rules.
// Extract numeric price
fze.local.price = fze.action("priceElement").innerText.ExtractFloat();
// Verify price under threshold
fze.local.price < 100.00;Combines operators (ExtractFloat) with logic for precise checks.