Skip to content
This repository has been archived by the owner on Feb 7, 2022. It is now read-only.

Error: Undefined variable "X" #25

Open
roma-glushko opened this issue Apr 6, 2020 · 3 comments
Open

Error: Undefined variable "X" #25

roma-glushko opened this issue Apr 6, 2020 · 3 comments

Comments

@roma-glushko
Copy link

roma-glushko commented Apr 6, 2020

The tool seems to strugle to find variables defines this way:

  <hashTree>
    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Benchmark" enabled="true">
      <stringProp name="TestPlan.comments"></stringProp>
      <boolProp name="TestPlan.functional_mode">false</boolProp>
      <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
      <stringProp name="TestPlan.user_define_classpath"></stringProp>
      <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
        <collectionProp name="Arguments.arguments">
          <elementProp name="host" elementType="Argument">
            <stringProp name="Argument.name">host</stringProp>
            <stringProp name="Argument.value">${__P(host,localhost)}</stringProp>
            <stringProp name="Argument.metadata">=</stringProp>
          </elementProp>
      </collectionProp>
      </elementProp>
    </TestPlan>
</hashTree>

I have got this error:

(node:55861) UnhandledPromiseRejectionWarning: Error: Undefined variable: host
    at variable (/Users/glushko/.nvm/versions/node/v12.14.1/lib/node_modules/jmeter-to-k6/src/string/interpolate.js:40:38)
    at evaluate (/Users/glushko/.nvm/versions/node/v12.14.1/lib/node_modules/jmeter-to-k6/src/string/interpolate.js:27:15)
    at replace (/Users/glushko/.nvm/versions/node/v12.14.1/lib/node_modules/jmeter-to-k6/src/string/interpolate.js:20:10)
    at /Users/glushko/.nvm/versions/node/v12.14.1/lib/node_modules/jmeter-to-k6/src/string/interpolate.js:10:38
    at Array.map (<anonymous>)
    at interpolate (/Users/glushko/.nvm/versions/node/v12.14.1/lib/node_modules/jmeter-to-k6/src/string/interpolate.js:10:25)
    at string (/Users/glushko/.nvm/versions/node/v12.14.1/lib/node_modules/jmeter-to-k6/src/string/convert.js:7:41)
    at value (/Users/glushko/.nvm/versions/node/v12.14.1/lib/node_modules/jmeter-to-k6/src/value.js:5:10)
    at extractValue (/Users/glushko/.nvm/versions/node/v12.14.1/lib/node_modules/jmeter-to-k6/src/common/property.js:20:19)
    at property (/Users/glushko/.nvm/versions/node/v12.14.1/lib/node_modules/jmeter-to-k6/src/common/property.js:11:25)
(node:55861) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:55861) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

console.log(context.vars) returns Map {} in the variable() method:

function variable (name, context) {
  console.log(context.vars)
  if (!context.vars.has(name)) throw new Error('Undefined variable: ' + name)
  return context.vars.get(name)
}

Here is a link to the full JMX file - https://raw.githubusercontent.com/magento/magento2/2.4-develop/setup/performance-toolkit/benchmark.jmx

@roma-glushko
Copy link
Author

@simskij happen to review this one as well?
I want to convert performance tests from Magento2 which is one of the top eCommerce platforms out there. That might be useful for LoadImpact as well if Magento2 merchants and agencies are able to use k6 instead of a bit outdated jMeter 😌

@simskij simskij self-assigned this May 25, 2020
@simskij
Copy link
Contributor

simskij commented Jan 8, 2021

Terribly sorry for keeping you waiting so long. 😓

@simskij simskij removed their assignment Nov 11, 2021
@simskij
Copy link
Contributor

simskij commented Nov 11, 2021

@sniku you might want to find someone else to review this 👍🏽

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

No branches or pull requests

2 participants