Check that there is no environment variable inside the response

To test this section I have to check an Environment Variable that is not inside this reponse
My response is here

    "status": "ok",
    "statusCode": "0000",
    "message": {
        "text": "",
        "type": ""
    "errors": [],
    "data": {
        "docs": [
                "name": "admin",
                "description": "نقش admin کل سیستم. با دسترسی به همه‌ی بخش ها (System generated)",
                "code": "T11AsR",
                "permissions": [
                "protected": true,
                "userType": "admin",
                "_id": "60b2607d6a286901dffe61fa"
                "name": "public",
                "description": "دسترسی های این نقش برای همه کاربران ثبت نام شده و احراز هویت شده مجاز است.",
                "code": "fh1xqE",
                "permissions": [
                "protected": true,
                "userType": "client",
                "_id": "60b2607f6a286901dffe61fb"
        "totalDocs": 2,
        "limit": 100,
        "totalPages": 1,
        "page": 1,
        "pagingCounter": 1,
        "hasPrevPage": false,
        "hasNextPage": false,
        "prevPage": null,
        "nextPage": null

My environment variable name is “new role code”
I just need to check that this is not inside the response
In addition, all this work is to be done in the test section in postman

And I want to check the code property

HI @science-architect-96,

You can extract all values of code in a separate array(Variable code) using the map function or for loop.

Then assert the output array not to include value stored in an environment variable(Variable envVar).


Hope this helps :slight_smile:

i should check that code property shouldnt have my envirment variable
i dont know the code

I have created a test code based on your inputs. You may try the below code

var res = pm.response.json();


var code =>{

    return doc.code;



var envVar=pm.environment.get('new role code');

pm.test("Your test name", function () {

    var jsonData = pm.response.json();



can this code be correct ?

var Data = pm.response.json();

if (pm.response.code === 200) {

pm.test("Role deleted", function () {

    var RoleCodes =,"code"));

    pm.expect(RoleCodes)"new role code"));

    postman.setNextRequest("Create user");



else {

var errors =,"message"));