Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Missing attribute value. attribute: {value}, parent: <property> #2

Open
abilous86 opened this issue Jan 22, 2020 · 15 comments
Open

Comments

@abilous86
Copy link

abilous86 commented Jan 22, 2020

Hello,

I'm receiving the following error when running collection using Newman with junitfull reporter:

/usr/local/lib/node_modules/newman-reporter-junitfull/node_modules/xmlbuilder/lib/XMLAttribute.js:14
        throw new Error("Missing attribute value. " + this.debugInfo(name));
        ^

Error: Missing attribute value. attribute: {value}, parent: <property>
    at new XMLAttribute (/usr/local/lib/node_modules/newman-reporter-junitfull/node_modules/xmlbuilder/lib/XMLAttribute.js:14:15)
    at XMLElement.module.exports.XMLElement.attribute (/usr/local/lib/node_modules/newman-reporter-junitfull/node_modules/xmlbuilder/lib/XMLElement.js:72:35)
    at XMLElement.module.exports.XMLElement.att (/usr/local/lib/node_modules/newman-reporter-junitfull/node_modules/xmlbuilder/lib/XMLElement.js:100:19)
    at /usr/local/lib/node_modules/newman-reporter-junitfull/lib/index.js:107:15
    at arrayEach (/usr/local/lib/node_modules/newman-reporter-junitfull/node_modules/lodash/lodash.js:516:11)
    at Function.forEach (/usr/local/lib/node_modules/newman-reporter-junitfull/node_modules/lodash/lodash.js:9342:14)
    at /usr/local/lib/node_modules/newman-reporter-junitfull/lib/index.js:104:7
    at arrayEach (/usr/local/lib/node_modules/newman-reporter-junitfull/node_modules/lodash/lodash.js:516:11)
    at Function.forEach (/usr/local/lib/node_modules/newman-reporter-junitfull/node_modules/lodash/lodash.js:9342:14)
    at EventEmitter.<anonymous> (/usr/local/lib/node_modules/newman-reporter-junitfull/lib/index.js:58:5)
    at EventEmitter.emit (/usr/local/lib/node_modules/newman/node_modules/eventemitter3/index.js:203:33)
    at done (/usr/local/lib/node_modules/newman/lib/run/index.js:280:29)
    at /usr/local/lib/node_modules/newman/node_modules/postman-runtime/lib/backpack/index.js:58:34
    at PostmanCollectionRun._process (/usr/local/lib/node_modules/newman/node_modules/postman-runtime/lib/runner/run.js:163:13)
    at PostmanCollectionRun.<anonymous> (/usr/local/lib/node_modules/newman/node_modules/postman-runtime/lib/runner/run.js:169:76)
    at ontimeout (timers.js:498:11)

I have 10 collection in my workspace and only one of them returns this error.
I even tried to execute a single request from the collection but still run is failing with the same error( all other collections are executed without any issues).

@anishkny
Copy link

anishkny commented May 5, 2020

Same error

@arauchberger
Copy link

me too

@arauchberger
Copy link

i'm using a collection with about 150 Request/Tests when i suddenly ran into this error.
i created a one-request-only collection -> works fine, but it's a bit hard to analyse which request/test exactly is causing this error.

but i could attach the collection/env, if you need.

thanks

@gh3rann
Copy link

gh3rann commented Sep 16, 2020

Same comment, I can provide evidence if needed. For me it happens evey time.

@FrancisBourgault
Copy link

FrancisBourgault commented Dec 2, 2020

I got that error when I used a variable inside to define the test name.

pm.test(pm.info.requestName+"-Status validation")

UPDATE: This was actually cause by extracting a properties from the response that didn't exist. It's fix for me.

@eugengaspar
Copy link

eugengaspar commented Dec 28, 2020

Hello guys!
Any update here, by any chance?
Lately, I'm also encountering the same issue:

  • when executing a collection with 10 requests => I encounter the error
  • when splitting the requests (same ones from above) into 10 different collections => error doesn't appear anymore ?!
    throw new Error("Missing attribute value. " + this.debugInfo(name));
    Error: Missing attribute value. attribute: {value}, parent: <property>
    at new XMLAttribute (/usr/lib/node_modules/newman-reporter-junitfull/node_modules/xmlbuilder/lib/XMLAttribute.js:14:15)

@Pixcell
Copy link

Pixcell commented Jan 22, 2021

Same error here. One collection, 280 requests, a couple of tests per request.
I have no new information, just following the thread to see if there is a resolution.
Simple JUnit reporter works perfectly fine, but is pretty useless since the tests are all aggregated

@tboulord
Copy link

Hello, I had the same issue.
After noticing that I only had this error on a specific environment (even on a simple request without tests), I fixed this issue by recreating the exact same environment.

Something to do with a corrupted environment json file ?

@b-for
Copy link

b-for commented Mar 31, 2021

I identified 2 situations which the reporter cannot handle and lead to the above mentioned error.

  1. Empty values for environment variables in the environment file, if they are represented by the null string.
    Changing this in the json file to an empty string value with 2 double quotes, will fix the issue: null => "". Or regenerate the file with a recent Postman version, this should also generate the empty value with double quotes.

  2. From within the test code, creating an environment variable (or changing the value of an existing, I guess), with the result of a function that does not return a value.

Example:

pm.environment.set("sessionid", pm.response.json().session);
Say the response json does not contain the session field. Then the sessionid environment variable will be set to null. And the reporter will fail.

A possible solution: test before you assign:

if (pm.response.json().session) {
pm.environment.set("sessionid", pm.response.json().session);
}

@vjppaz
Copy link

vjppaz commented Jun 20, 2021

any update or workaround?

It is working when I execute the test on local (JUnitResult file was generated) but when execution happens in Azure Pipeline this error occurs

@vjppaz
Copy link

vjppaz commented Jul 15, 2021

SOLVED ON MY END!

The reason why it keeps on failing on my end is because there are requests from my collection that requires a "FILE". After fixing the path using work directory my Test Automation in Azure Pipeline is now working!

@naasse
Copy link

naasse commented Jan 26, 2022

This is a really easy fix. I use a forked version of this repo where the same bug exists.

See my PR bhecquet#10

I'd suggest somebody who wants this repo fixed request the same here.

@vjppaz
Copy link

vjppaz commented Jul 7, 2022

workaround: make your that you don't have any variable or environment variable that has a "NULL" value.

If only the XMLAttribute.js line#14 has this below line of code instead the current one, we would never have this kind of exception:

      if (name == null) {
        this.name = "unknown";
      }
      else {
 	this.name = this.stringify.attName(name);
      }
      if (value == null) {
        this.value = "null";
      }
      else {
        this.value = this.stringify.attValue(value);
      }

@JoSSte
Copy link

JoSSte commented Jan 5, 2023

I identified 2 situations which the reporter cannot handle and lead to the above mentioned error.

  1. Empty values for environment variables in the environment file, if they are represented by the null string.
    Changing this in the json file to an empty string value with 2 double quotes, will fix the issue: null => "". Or regenerate the file with a recent Postman version, this should also generate the empty value with double quotes.
  2. From within the test code, creating an environment variable (or changing the value of an existing, I guess), with the result of a function that does not return a value.

Example:

pm.environment.set("sessionid", pm.response.json().session);
Say the response json does not contain the session field. Then the sessionid environment variable will be set to null. And the reporter will fail.

A possible solution: test before you assign:

if (pm.response.json().session) {
pm.environment.set("sessionid", pm.response.json().session);
}

I experienced the exact same solution as this - maybe the smarter solution would be to post a proper warning message so we can clean up our testsuites?

@hvitis
Copy link

hvitis commented Dec 22, 2023

SOLVED ON MY END!

The reason why it keeps on failing on my end is because there are requests from my collection that requires a "FILE". After fixing the path using work directory my Test Automation in Azure Pipeline is now working!

👆🏻 Solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests