Body parameters in Blazemeter - testing

I'm importing test with OAS in blazemeter but I'm having the problem that in the POST methods the body parameters are not set, instead it puts an uninitialised variable.
Is there any solution for this or BM does not support this behaviour?

Related

Jmeter 5.4.1 - Groovy script error 'No signature of method'

Newly back to using Jmeter after a 3 year break and pretty confused by this error.
I have a JSR223 Preprocessor which is used for generating AWS signatures and it keeps generating errors of the following type:
021-10-20 13:47:40,101 ERROR o.a.j.m.JSR223PreProcessor: Problem in JSR223 script, Create AWS Signature
javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: org.apache.jmeter.protocol.java.sampler.JSR223Sampler.getMethod() is applicable for argument types: () values: []
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:158) ~[groovy-jsr223-3.0.7.jar:3.0.7]
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233) ~[java.scripting:?]
It's not causing the tests themselves to fail (weirdly) but it would be useful to stop these errors clogging our log files.
Help?!
It looks like you added the JSR223 PreProcessor as a child of the JSR223 Sampler which doesn't really have getMethod() function.
The function is available for HTTPSamplerBase class and derivatives.
In other words you need to put the JSR223 Preprocessor as a child of the HTTP Request sampler and it should start working as expected.
More information: How to Handle Dynamic AWS SigV4 in JMeter for API Testing
Make sure you uncheck checkbox on JSR223 Sampler >> Cache compiled script if available. It looks like script is cached and not recompiled, resulting in old code being run. Also make sure your old code is not hidden in the bottom of script editor window (scrollbar sometimes does not display correctly how much content is hidden).

In Talend API tester, how to send a request without evaluating environment variables in ${}

I have a request I want to send using Talend API tester.
In the request there are instances where I want to send a payload such as:
{ "channel" : "${channelId}" }.
But Talend API tester evaluates anything in a ${} as an environment variable, thus they payload sent will be in the form:
{ "channel" : "channelId" }.
Is there any way to force the API tester to ignore the ${} delimiter, and send it with the payload so that it may be evaluated internally once it has reached the server.
My issue was caused by using "Talend API Tester" as my API Client software.
This API tester allows for Environment Variables to be set which will be evaluated before the payload is sent.
Since I had no environment variable set to "channelId" the content: ${channelId} was being evaluated to just "channelId".
To solve the issue I have found two solutions:
Use a different API Client such as Postman API Client.
Set Talend API Tester to not evaluate Environment Variables by unchecking the [Enable Body Evaluation] button just below the Body section in the Talend API Tester. ( I had looked into the main Settings, but never found any solution. It wasn't in the Settings, but on the middle of the main Client)

how to use __eval in preprocessor of jmeter

I am using a faker.jar plugin to generate random data inside json file
The JSON file is like
{
"name" = "${__BeanShell(new com.github.javafaker.Faker().name().fullName())}"
"id" = "${__BeanShell(new com.github.javafaker.Faker().IdNumber())}"
}
and in jmeter i am using a http sampler
This is working fine, but now i want to evaluate the request with response, so i want to save the request body inside a variable and pass that variable to http request and then use post process to evaluate request against response, but i am unable to use ${__eval()} function inside preprocessor.
How to fix that
Add JSR223 PreProcessor as a child of the HTTP Request sampler
Put the following code into "Script" area:
vars.put('foo', sampler.getArguments().getArgument(0).getValue())
3 That's it, the PreProcessor will fetch the body data from the HTTP Request sampler and store it into ${foo} JMeter Variable.
Be aware that according to JMeter Best Practices you should be using __groovy() function instead of __Beanshell() so consider amending your JSON file on next available opportunity.
Be also informed that JMeter provides some built-in functions allowing generation of random values i.e. __Random(), __RandomString(), __UUID(), etc. so you might even discard your 3rd-party library as JMeter built-in functions provide better performance.

Accessing the built request details in Karate

Just like how the response information can be accessed through response, responseHeaders etc, is there any way to access the request information? I noticed that request information is not available through variables. Are there are any workarounds to access this information?
I understand that we build the request ourselves in the test scenario using the Given, When steps, so it may sound redundant. The reason I'm looking for this is I would like to access the complete request details Karate would've built using our test definition. The idea is to make this information available to a java class which can be called through the Java Interop. More specifically, I'm trying to build a swagger request and response validator to be used from karate.
The workaround I am using is to explicitly create variables like apipath and apimethod and use them with path and method. This does the job, but still one has to ensure that these variables are explicitly set. It will be cleaner if whatever request Karate built is just accessible through a variable.
Please raise a feature request. We can look at making this available as karate.request or similar.

How to process and insert user defined variable from/in SOAP Response/Request i in Jmeter ? SOAP request parametrization in jmeter

I am trying to solve following problem:
I have a system with which communication is done through SOAP (XML over http).
In Jmeter I am using SOA/XML-RPC (not wsdl based webservice).
I am sending one SOAP request and receiving response in vollowing tag
<Prodrevision>5</Prodrevision>
This number changes from time to time and goal is to get that number in that tag put it as user defined variable and pass it to another SOAP/XML-RPC
Mine jmeter test plan looks like that
-User defined variabla - here I have empty varaibla named "var'
-SOAP/XML- RPC (this SOAP REQUEST causes that RESPONSE is received)
- XPath Extractor with
reference name: var
XPath Query: //*[local-name()='Prodrevision']/text()
(this should according to FAQ's process/parse response and asssign it to variable var)
-SOAP/XML-RPC - and in this XML request SOAP/XML-RPC data field has
..xml data
<Prodrevision>${var}</Prodrevision>
...xml data
But I am not sending anything in the second request ??? mine requests hits server but there is no value.
Where I made a mistake?
Whenever you see ${variableName} in the request, it means the variable hasn't been defined. Most likely, it's an issue with how XPath is setup. I've never used that component, so unfortunately I can't help you there.
However, I've found the post processor Regular Expression Extractor to be very easy and accurate.
The structure would like this:
1st Soap Request
-- regular expression stored to "var"
2nd Soap Request, using ${var}
The problem has been partially solved.
There was an issue in a wrong or badly, for JMeter, defined XPath query
reference name: var
XPath Query://name[contains(text(),'Prodrevision')]/parent::multiRef/value
After the XPath query I have added beanshell postprocessor with following code
print("Beanshell processing SOAP response");
print("var" +${var} );
So finally I see what value is being grabbed by the XPath extractor.
I have also installed xpather 1.4.5 as a Firefox add-on. And opened XML response and tuned a bit XPath query to have a proper answer. Then this was copied to JMeter and worked.
Next, in SOAP request that had to be sent by JMeter, I have put my XPath extractor value in the following way:
<name xsi:type="soapenc:string">Prodrevision</name>
<value xsi:type="soapenc:string">${var}</value>
and this again worked well for one thread.
Problem at this moment is with threads. If there is more than 1 (one) thread, it is generating wrong requests :-(