JMeter: url encoded embedded resources - jmeter

I'm setting up some tests with JMeter, and I've seen that it's throwing out an error where trying to download embedded resources inside a web page, that have a path like the following:
www.mydomain.com/resources?getItem={someID}
The problem is that the characters need to be URL-encoded, so the following URL should follow this pattern:
www.mydomain.com/resources?getItem=%7BsomeID%7D
Now, how could instruct JMeter to replace these characters, when found on URLs from embedded resources in the web page? I've been looking at BeanShell PreProcessors, but I'm not sure how's the best way to handle this scenario.
Thanks!

You are facing this bug:
https://bz.apache.org/bugzilla/show_bug.cgi?id=58137
Until bug is fixed, your option is to disable embedded download and use :
CSS/ JQuery Post Processor to extract URLs
Use ForEach Controller to iterate over urls
This will only simulate serial download not parallel one.
Update 15th july 2015:
Bug has been fixed yesterday night, you can give nightly build a try:
http://jmeter.apache.org/nightly.html
Read:
Installing JMeter runtime
Download the _bin and _lib files
Unpack the archives into the same directory structure
The other archives are not needed to run JMeter.

What about this built in Jmeter function?
http://jmeter.apache.org/usermanual/functions.html#__urlencode

Related

JMeter embedded resources not named correctly

I'm using an HTTP sampler to download embedded resources. Here's is the example from python.org. I was expecting the the names of the embedded resources to match the actual request. But instead they're named the same as the parent sample. Could be by product of HTTPS? I'm using JMeter 5.3.
This is a part of enhancement introduced in JMeter 5.0, see Bug 62550 - Modify SubResult Naming Policy for details.
If the previous behaviour is really what you're looking for you can get it back in 2 ways:
Tick "Functional Test Mode" box at Test Plan level
Add subresults.disable_renaming=true line to user.properties file
when you record the transaction it should generate the sample names normally.
Are you using parallel controller ?
Actually you can tweak with settings of naming policy in jmeter properties.

Jmeter encoding of URL path

I have an URL path
path=mcat official mcat critical analysis and reasoning skills question pack volume 1 online.html
I want to encode with - in place of spaces.
e.g-mcat-official-mcat-critical-analysis-and-reasoning-skills-question-pack-volume 1-online.html
How will I do this in jmeter?
You can use __strReplace function which is available via Custom Functions bundle of the JMeter Plugins project. You can install it using JMeter Plugins Manager. The syntax would be
${__strReplace(${path}, ,-,)}
If you don't want (or cannot use) the plugins you can achieve the same using __groovy() function, in this case the syntax will be:
${__groovy(vars.get('path').replace(' '\, '-'),)}
Both examples assume that your URL is stored in ${path} JMeter Variable.
Demo:

Jmeter 3.2- Error in NonGUIDriver org.apache.jorphan.util.JMeterStopTestException

I have a JMeter test suite, which is working fine till apache-jmeter-2.13.
When upgrade to JMeter 3.2 and I get below exceptions in non GUI mode.
I didn't do any change in the JMeterscript, why this error is throwing in JMeter versions later 2.13 or in version 3.2?
jmeter -n -t E:\testsuite.jmx -l E:\tmp\RORlogs.csv
Error in NonGUIDriver org.apache.jorphan.util.JMeterStopTestException: ModuleCon
troller:Tracker_List_Artifacts has no selected Controller (did you rename some e
lement in the path to target controller?)
Test was shutdown as a consequence
Add an answer to close the problem:
In earlier versions of jmeter 2.13, it didn't validate the controllers which is disabled.
But from Jmeter version 3.2, irrespective of disabling all the controllers should have proper target values.
Fix the issue by assign proper target controller is assigned to disabled module controller.
Not sure if you've got the exact same situation, but what we've found is that JMeter has a problem where if you have a script with a module controller that includes another script that also has a module controller the file paths may be off and so the module controller of the included script will error.
For example. Say I have 'main.jmx' that has a module controller that points to 'external.jmx'. 'external.jmx' has a module controller that points to 'another_script.jmx'.
'main.jmx' is located in 'Documents/scripts', and this is also the directory we lauched JMeter from. 'main.jmx' has a relative path that points to 'external.jmx'. However, 'another_script.jmx' does not have the same relative path and so JMeter throws an error.
Pro tip: renaming your test elements to descriptive names will make debugging scripts far easier (it looks like you've done this, but this is more for other people reading this).
I am using Jmeter 5* and here irrespective of how many target controller names you modify, you finally need to touch all transactions/module controller from top to bottom once. Its kind of re-associating module controller with target controller. After that its working fine for me.

excluding files with guard-jasmine while running coverage

I am using guard-jasmine create coverage reports for my javascript app written with backbone js. I would like to exclude the template files from being included in the coverage. Is there a way to do this currently? I have also tried looking through the source and passing the -x option to the intrument command in the coverage.rb file but that doesn't seem to help at all. Any pointers would be appreciated.
Thanks!
There is currently no way of configuring Guard::Jasmine to skip specific files from generating the coverage.
A possible way to add this would be to add something like a coverage_skip option that contains a regex to check it as a preconodition in the coverage tilt template:
return data if file =~ ENV['COVERAGE_SKIP']
Since we do not have access to the Guard::Jasmine options, we need to set it as an environment variable in the server process.
A pull request is heartly welcome ;)

How to use exported script from Badboy in jmeter?

Recorded my case in Badboy and exported to jmeter which is saved in desktop. Now how to use this script in jmeter ?
Run JMETER_HOME/bin/jmeter.bat and use File> Open the JMX script recorded via Badboy.
It works!
Like joseK said, you just have to open it via your File/Open Menu in jmeter ...
Or you mean that you've opend it and its not working, in that case you might have some change to do in your exported jmeter test.
Here some problem I got using badboy :
on our apps, badboy seem to add get request that didn't work at all, We had to remove them manually in order to fix the problem.
And if you have a token or session id that you need to extract from your cookies or http response, it's doesn't take care of it for you so you got to figure out how to extract them with a reg-ex extrator and put in a variable that your test will use.
See this link - could be a compatibility problem, if you are running jmeter 2.4 (badboy exports do not work with 2.4 yet). You might have to download 2.3.4 in order to convert the badboy script into a version compatible with 2.4
http://www.pukkared.com/2011/06/using-badboy-to-build-jmeter-test-plans-over-an-ssl/

Resources