No results for

Powered byAlgolia
⚠️ This is archived documentation for v0.33. Go to the latest version

and(value)

suggest edits

and(value) works the same as expect(value), but can be used to chain multiple tests together.

ParameterTypeDescription
valueanyThe value to be compared

Returns

TypeDescription
FunkFunk object

Example

import { describe } from 'https://jslib.k6.io/expect/0.0.4/index.js';
import http from 'k6/http';
export default function testSuite() {
describe('Basic API test', (t) => {
let response = http.get("https://test-api.k6.io/public/crocodiles")
t.expect(response.status).as("response status").toEqual(200)
.and(response).toHaveValidJson()
.and(response.json().length).as("number of crocs").toBeGreaterThan(5);
})
}