Numerical values only, no decimals -- just started coding HELP!

This must be a very beginner question, but how to I get it to make sure that the value is purely numerical, and spit out a error if the value is per say :apple, or :100.1 instead of just being :100.

pm.test(“Your test name”, function () {
var jsonData = pm.response.json();

As an example I need to make sure the value is greater then 0, but I was told that JavaScript will consider :apple, and :0.1 as greater then 0. Is there a way to have it only accept whole numeric values?


It’s true that JavaScript comparisons may not always do what you’d expect. The test framework in place within Postman helps cover off a few of those issues though.

You’re just missing a small piece of syntax in your test

Try pasting these tests into Postman and seeing how they behave. You can modify them from there :slight_smile:

pm.test("1.1 is higher than 1", function () {

pm.test("0.9 not higher than 1", function () {

pm.test("any kind of string value fails", function () {
    pm.expect("some string");

Here’s a link to some useful reference for expect