You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update k6 testing documentation and examples (#2056)
* feat(tests): update k6 testing documentation and examples
* set param version in examples
* set hash last commit writers-toolkit
* fix(workflows): revert writers-toolkit version to v1 for consistency
* fix(workflows): update writers-toolkit version to v1 for consistency
description: 'The k6 testing library provides test assertion capabilities for both protocol and browser testing.'
4
4
weight: 00
5
5
---
6
6
7
-
# testing
7
+
# k6-testing
8
8
9
-
The k6 testing library provides assertion capabilities for both protocol and browser testing, and draws inspiration from Playwright's test API design. The entire library is centered around the [`expect()`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/testing/expect) function, which can be configured for convenience.
9
+
The k6 testing library provides assertion capabilities for both protocol and browser testing, and draws inspiration from _Playwright_'s test API design.
10
+
The entire library is centered around the [`expect()`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/testing/expect) function, which can be configured for convenience.
10
11
11
12
{{< admonition type="note" >}}
12
13
The k6 testing library source code is available on [GitHub](https://github.com/grafana/k6-jslib-testing).
13
14
{{< /admonition >}}
14
15
15
16
## Features
16
17
17
-
-**Playwright-inspired assertions**: API designed with patterns inspired by Playwright's testing approach
18
+
-**[Playwright-inspired assertions](https://playwright.dev/docs/test-assertions)**: API designed with patterns inspired by Playwright's testing approach
18
19
-**[Protocol and browser testing](#demo)**: Works with both HTTP/API testing and browser automation
19
20
-**[Auto-retrying assertions](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/testing/expect#retrying-assertions)**: Automatically retry assertions until they pass or timeout
20
21
-**[Soft assertions](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/testing/expect#soft-assertions)**: Continue test execution even after assertion failures
Synchronous assertions that evaluate immediately. These are ideal for testing static values, API responses, and scenarios where the expected condition should be true at the moment of evaluation.
Asynchronous assertions that automatically retry until conditions become true or timeout. These are suitable for browser testing, dynamic content, and scenarios where conditions may change over time.
120
128
121
129
## API Reference
122
130
123
-
| Function | Description |
124
-
| --- | --- |
125
-
|[expect()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/testing/expect)| Main assertion function |
Copy file name to clipboardExpand all lines: docs/sources/k6/v1.2.x/javascript-api/jslib/testing/_index.md
+40-32Lines changed: 40 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,21 @@
1
1
---
2
-
title: 'testing'
2
+
title: 'k6-testing'
3
3
description: 'The k6 testing library provides test assertion capabilities for both protocol and browser testing.'
4
4
weight: 00
5
5
---
6
6
7
-
# testing
7
+
# k6-testing
8
8
9
-
The k6 testing library provides assertion capabilities for both protocol and browser testing, and draws inspiration from Playwright's test API design. The entire library is centered around the [`expect()`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/testing/expect) function, which can be configured for convenience.
9
+
The k6 testing library provides assertion capabilities for both protocol and browser testing, and draws inspiration from _Playwright_'s test API design.
10
+
The entire library is centered around the [`expect()`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/testing/expect) function, which can be configured for convenience.
10
11
11
12
{{< admonition type="note" >}}
12
13
The k6 testing library source code is available on [GitHub](https://github.com/grafana/k6-jslib-testing).
13
14
{{< /admonition >}}
14
15
15
16
## Features
16
17
17
-
-**Playwright-inspired assertions**: API designed with patterns inspired by Playwright's testing approach
18
+
-**[Playwright-inspired assertions](https://playwright.dev/docs/test-assertions)**: API designed with patterns inspired by Playwright's testing approach
18
19
-**[Protocol and browser testing](#demo)**: Works with both HTTP/API testing and browser automation
19
20
-**[Auto-retrying assertions](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/testing/expect#retrying-assertions)**: Automatically retry assertions until they pass or timeout
20
21
-**[Soft assertions](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/testing/expect#soft-assertions)**: Continue test execution even after assertion failures
0 commit comments