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

Is this version support for jMeter 5.1.1? #14

Closed
awcodify opened this issue Apr 24, 2019 · 8 comments · Fixed by #17
Closed

Is this version support for jMeter 5.1.1? #14

awcodify opened this issue Apr 24, 2019 · 8 comments · Fixed by #17

Comments

@awcodify
Copy link

I've tried to convert my JMX file to k6. First, I got an error for CacheManager. Fortunately CacheManager not being useful for my script, so I remove the CacheManager and I got another error. There is an error when I create user-defined variables.

In simple, these are the errors I faced:

  1. Error CacheManager element
  2. User Defined Variable error
@bookmoons
Copy link
Contributor

Hi aw. Thanks for the error report.

I think the CacheManager is unsupported. But UserDefinedVariables should work. Is it possible you could post an example JMX file that causes the error?

@awcodify
Copy link
Author

awcodify commented Apr 24, 2019

ah, sorry it's not a user-defined variable. it's a CSV Data Set Config. But if I'm not wrong, I also got an error after removing CSV Data Set Config, the error is related to a user-defined variable

@bookmoons
Copy link
Contributor

That CSV element should be working too. If you can post an example, I can investigate.

@awcodify
Copy link
Author

      <CSVDataSet guiclass="TestBeanGUI" testclass="CSVDataSet" testname="CSV Data Set Config" enabled="true">
        <stringProp name="delimiter">,</stringProp>
        <stringProp name="fileEncoding"></stringProp>
        <stringProp name="filename">/Users/user/Documents/jmeter/search_keyword.csv</stringProp>
        <boolProp name="ignoreFirstLine">false</boolProp>
        <boolProp name="quotedData">false</boolProp>
        <boolProp name="recycle">true</boolProp>
        <stringProp name="shareMode">shareMode.all</stringProp>
        <boolProp name="stopThread">false</boolProp>
        <stringProp name="variableNames">search_keyword</stringProp>
      </CSVDataSet>

And i got this error:

jmeter-to-k6 ~/Documents/jmeter/EVENT-DEtAIL.jmx -o all
/Users/user/.asdf/installs/nodejs/11.13.0/.npm/lib/node_modules/jmeter-to-k6/src/string/interpolate.js:39
  if (!context.vars.has(name)) throw new Error('Undefined variable: ' + name)
                               ^

Error: Undefined variable: search_keyword
    at variable (/Users/user/.asdf/installs/nodejs/11.13.0/.npm/lib/node_modules/jmeter-to-k6/src/string/interpolate.js:39:38)
    at evaluate (/Users/user/.asdf/installs/nodejs/11.13.0/.npm/lib/node_modules/jmeter-to-k6/src/string/interpolate.js:27:15)
    at replace (/Users/user/.asdf/installs/nodejs/11.13.0/.npm/lib/node_modules/jmeter-to-k6/src/string/interpolate.js:20:10)
    at ranges.map.range (/Users/user/.asdf/installs/nodejs/11.13.0/.npm/lib/node_modules/jmeter-to-k6/src/string/interpolate.js:10:38)
    at Array.map (<anonymous>)
    at interpolate (/Users/user/.asdf/installs/nodejs/11.13.0/.npm/lib/node_modules/jmeter-to-k6/src/string/interpolate.js:10:25)
    at string (/Users/user/.asdf/installs/nodejs/11.13.0/.npm/lib/node_modules/jmeter-to-k6/src/string/convert.js:7:41)
    at value (/Users/user/.asdf/installs/nodejs/11.13.0/.npm/lib/node_modules/jmeter-to-k6/src/value.js:5:10)
    at extractValue (/Users/user/.asdf/installs/nodejs/11.13.0/.npm/lib/node_modules/jmeter-to-k6/src/common/property.js:13:19)
    at property (/Users/user/.asdf/installs/nodejs/11.13.0/.npm/lib/node_modules/jmeter-to-k6/src/common/property.js:8:20)

@bookmoons
Copy link
Contributor

Thanks aw. Will see if I can work out what's happening.

@bookmoons
Copy link
Contributor

Hi again aw. Think I have an idea of what's happening here. It's not quite getting those CSV variables to the right place. Will be looking into a fix when I can.

@nenadcvetkovic
Copy link

nenadcvetkovic commented Jun 4, 2019

This problem is happening in case when you want to use data from CSV file in your tests. You can reproduce it if you create "CSV Data Set Config" with variable names username,password.
Then in your HTTP Request you use username and password from CSV file to login. In "Send Parameters With the Request" add parameter name username and parameter value ${username}.

If you run converter it will throw that exception Error: Undefined variable: username, because it couldn't find username in the context. So, basically the error is happening because context is not set at all. It is empty.

This is very important to have, and because of this error, the converter becomes useless.

NOTE: The test code does not cover this situation.

NOTE 2: Here is XML sample:

<collectionProp name="Arguments.arguments">
   <elementProp name="username" elementType="HTTPArgument">
      <boolProp name="HTTPArgument.always_encode">true</boolProp>
      <stringProp name="Argument.value">${username}</stringProp>
      <stringProp name="Argument.metadata">=</stringProp>
      <boolProp name="HTTPArgument.use_equals">true</boolProp>
      <stringProp name="Argument.name">username</stringProp>
    </elementProp>
</collectionProp>

@bookmoons
Copy link
Contributor

@awcodify I've opened a patch #17 that I think solves your problem. If you still see the issue let me know, I can poke around some more.

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

Successfully merging a pull request may close this issue.

3 participants