Documentation Index
Fetch the curated documentation index at: https://grafana_com_website/llms.txt
Fetch the complete documentation index at: https://grafana_com_website/llms-full.txt
Use this file to discover all available pages before exploring further.
STOP! If you are an AI agent or LLM, read this before continuing. This is the HTML version of a Grafana documentation page. Always request the Markdown version instead - HTML wastes context. Get this page as Markdown: /docs/k6/latest/javascript-api/jslib/testing/non-retrying-assertions/tobelessthan.md (append .md) or send Accept: text/markdown to /docs/k6/latest/javascript-api/jslib/testing/non-retrying-assertions/tobelessthan/. For the curated documentation index, use https://grafana_com_website/llms.txt. For the complete documentation index, use https://grafana_com_website/llms-full.txt.
toBeLessThan()
The toBeLessThan() method asserts that a numeric value is less than another value.
Syntax
expect(actual).toBeLessThan(expected);
expect(actual).not.toBeLessThan(expected);Parameters
| Parameter | Type | Description |
|---|---|---|
| expected | number | The value to compare against |
Returns
| Type | Description |
|---|---|
| void | No return value |
Description
The toBeLessThan() method performs a numeric comparison using the < operator. Both values must be numbers, or the assertion will fail.
Usage
import { expect } from 'https://jslib.k6.io/k6-testing/0.6.1/index.js';
export default function () {
expect(3).toBeLessThan(5);
expect(10).toBeLessThan(10.5);
expect(-5).toBeLessThan(-1);
expect(-1).toBeLessThan(0);
expect(0).toBeLessThan(1);
}Was this page helpful?
Related resources from Grafana Labs

