Not able to remove characters from the string using bean shell sampler - jmeter

Using bean shell sampler in jmeter how can i remove the characters before "$bbbb,P10,868324023031300,20160816090741" from the below string
"=xxxxIoT2?data=$bbbb,P10,868324023031300,20160816090741"

There are many possible options, you need to give us a little bit more details so we could come up with the best solution. In the meantime, here is the most straightforward way:
String before = "=xxxxIoT2?data=$bbbb,P10,868324023031300,20160816090741";
String after = before.split("data=")[1];
Demo:
Also be aware that Beanshell is not the best scripting option so please consider switching to JSR223 Sampler and Groovy language as Groovy:
is more Java-compliant (Beanshell is stuck on Java 1.5 language level)
performs better (well-behaved Groovy scripts can be compiled into native Java code)
has some enhancements on top of Java SDK which make developers lives easier
See Apache Groovy - Why and How You Should Use It for more information.

Related

Way to import node modules inside jmeter

Whether node modules can be used inside jmeter?
For example can we import node modules inside webdriver sampler?
Node.js is a server-side scripting engine, the only "good" way to use it from JMeter is via OS Process Sampler
If you want to use some Node.js module in the browser driven by Selenium you might want to take a look at browserify which is capable of producing a single .js file which you can load and call its functions.
In general the only recommended scripting option in JMeter is using JSR223 Test Elements and Groovy language, I'm pretty sure that your requirement can be implemented in Groovy

Jmeter - extend http test recorder

Is it possible to extend Jmeter http script test recorder?
Would like to edit recorded requests automatically instead of doing it manually.
JMeter is an open source software distributed under Apache License 2.0 so you can add whatever functionality you need.
JMeter source code is available via Git and SVN repositories and you can find the official manual on extending JMeter at How to Write a plugin for JMeter
If you'll create something very useful for others I believe it would be a good idea to contribute it back, send a message to Apache JMeter Developer for further instructions on how you can add your code to JMeter.
If your idea of "automatic editing" is about adding missing automated correlation and you need the functionality right away you can consider and alternative recording service instead of JMeter's built-in proxy, check out How to Cut Your JMeter Scripting Time by 80% guide for details.
Of course it is possible. Look at this one

Looking for an Object Oriented JMeter example

I'm looking to abstract the sequence of REST calls for complicated behaviors in my company's app into a series of classes that are instantiated as needed and the methods would effectively create the sequence of HTTP request calls. It's my hope that doing this would make the tests more compact and readable (as well as providing more reusable code). I would need to utilize the StandardJmeterEngine and export the test to JMX format after the HashTree test plan is created.
To cut on development time, I'm hoping to find a nice example of this; I'm sure someone's done it, but I've yet to stumble onto it.
If you are looking into the way of programmatic creation JMeter test take a look into the following sources:
JMeter API
How to Write a plugin for JMeter
Five Ways To Launch a JMeter Test without Using the JMeter GUI
If you are looking for an example project you can check out jmeter-from-code solution which demonstrates creating a JMeter Test Plan programmatically, storing it into a .jmx script file, running it and getting the .jtl results file.

Automating Correlation in JMeter

My scripts have lot of dynamically changing variables for which I need to use correlation (regular expression / xpath extractor) Is there any way with which we can automate or minimize this and with which JMeter can identify the variables and auto find and replace it.
Your suggestion would be very helpful.
Thanks in advance
Have you considered the test development shell of OctoPerf? At least for me it takes an enormous amount of pain out of Jmeter test code development.
And no, I don't work for them....
It is possible using 3rd party recording service in SmartJMX mode which performs automatic correlation of any dynamic parameters including timestamps, usernames, etc.
See How to Cut Your JMeter Scripting Time by 80% guide for more details.

Jmeter wamp-protocol integration

Here is the story:
we have several servers connected to wamp (crossbar.io)
I am creating load tests for part of this system and need a way to get info from wamp server to Jmeter.
So far I found only WS plugin for Jmeter, but it wont work with wamp.
Any bright ideas?
Clearly wamp is a whole new protocol and JMeter doesn't support it out-of-the-box. Thankfully you can extend JMeter quite easily. If there are java or java family language bindings for your protocol system, you can use beanshell sampler (relatively less performant) or groovy through JSR223 sampler (better performance)
If you feel like it, you can always write up your own Wamp sampler as well.

Resources