Results: 1578
Notes
  • Newest first
  • Oldest first
  • Newest first(All)
  • Oldest first(All)
<?php $cars=array("Volvo","BMW","Toyota"); echo count($cars); ?>
by გიორგი ბაკაშვილი
4 years ago
0
PHP
Array
PHP official doc
0
check response time in milliseconds using environment variable
Tests that response time is below 100ms
pm.environment.set("allowedMilliseconds", 100);

pm.test("Response time is less than "+pm.environment.get("allowedMilliseconds")+"ms", function () {
    pm.expect(pm.response.responseTime).to.be.below(pm.environment.get("allowedMilliseconds"));
});
by Valeri Tandilashvili
4 years ago
0
Postman
postman tests
2
check response header value
Tests that the header
Content-Type
is equal to
application/json; charset=utf-8
pm.test("Content-Type is application/json", function () {
    pm.response.to.be.header("Content-Type", "application/json; charset=utf-8");
});
by Valeri Tandilashvili
4 years ago
0
Postman
postman tests
0
check if the response includes certain header
Tests that the response includes header:
Content-Type
pm.test("Content-Type is application/json", function () {
    pm.response.to.have.header("Content-Type");
});
by Valeri Tandilashvili
4 years ago
0
Postman
postman tests
0
check that the response JSON text is equal to the specified text
Tests that the response JSON is equal to the specified text
pm.test("Body is correct", function () {
    pm.response.to.have.body('{"status":{"code":400,"text":"Mobile Number is required"}}');
});
The response JSON
{
    "status": {
        "code": 400,
        "text": "Mobile Number is required"
    }
}
The test returns
true
because the text passed to the test is the same as the response JSON
by Valeri Tandilashvili
4 years ago
0
Postman
postman tests
1
check if the response JSON includes certain text
Tests that the response JSON includes text:
Mobile Number
pm.test("Body matches string", function () {
    pm.expect(pm.response.text()).to.include("Mobile Number");
});
The response JSON
{
    "status": {
        "code": 400,
        "text": "Mobile Number is required"
    }
}
by Valeri Tandilashvili
4 years ago
0
Postman
postman tests
1
check if the property exists in the response JSON
Tests that the property
status
exists in the response JSON
pm.test('Has "status" property', function() {
    var jsonData = pm.response.json();
    pm.expect(jsonData).to.have.property('status');
});
The response JSON
{
    "status": {
        "code": 400,
        "text": "Mobile Number is required"
    }
}
by Valeri Tandilashvili
4 years ago
0
Postman
postman tests
0
check the response HTTP status code
Tests that the response HTTP
status code
is equal to
400
pm.test("Status code is 400", function () {
    pm.response.to.have.status(400);
});
by Valeri Tandilashvili
4 years ago
0
Postman
postman tests
0
check if the key exists in the response JSON
Tests that key
text
exists in the response JSON
pm.test("status text key exists", function () {
    var jsonData = pm.response.json();
    pm.expect(jsonData.status.text !== undefined).to.eql(true);
});
The response JSON
{
    "status": {
        "code": 400,
        "text": "Mobile Number is required"
    }
}
by Valeri Tandilashvili
4 years ago
0
Postman
postman tests
0
check the response JSON key value
Tests that the value of
code
key is equal to
400
pm.test("status code is equal to invalid HTTP request", function () {
    var jsonData = pm.response.json();
    pm.expect(jsonData.status.code).to.eql(400);
});
The response JSON
{
    "status": {
        "code": 400,
        "text": "Mobile Number is required"
    }
}
by Valeri Tandilashvili
4 years ago
0
Postman
postman tests
0
Results: 1578