Not saving Certificate while recording in bin directory - jmeter

When I start recording script it shows A certificate will be saved in bin. In bin a Certificate and .usr file were saved.
But then I delete the .crt and .usr file from the folder due to some reason.
Now again when I am doing the recording , it shows the message that the certificate will be saved in bin but when check it shows no certificate saved over there.
Tried this many times.
And I permanently delete the files other I could recover them.
To test repeatability, the .crt and .usr were removed and the test was
repeated. Upon start of the 'HTTP(S) Test Script Recorder', NO new .crt or .usr
file was created.

Because these are only browser certificates, if you want JMeter to regenerate them you need to delete proxyserver.jks file, once you remove it - JMeter will re-generate it back along with ApacheJMeterTemporaryRootCA.crt file and friends.
Alternatively you can get the files back using keytool or Keystore Explorer
Also be aware that you can also record JMeter tests using JMeter Chrome Extension, in this case you don't have to worry about proxies and certificates.
And last but not the least, as per JMeter Best Practices you should always be using the latest version of JMeter so consider upgrading as your JMeter 3.2 is a little bit outdated

Related

Why does WinSCP see remote files as changed/updated when they aren't?

Good day.
I'm using WinSCP to synchronise a folder on a remote server to a folder on my computer (my local folder becomes the copy). The folder contains lots of .TXT and .LOG files, and a few subfolders also containing the same filetypes. I use the Commands -> Static Custom Commands -> Keep local directory up to date feature to keep my local folder synchronised. This feature spawns a PowerShell script which checks the remote folder every 30 seconds. If there's any new/changed files, it downloads them to my local folder. This worked for months, but suddenly it's seeing many old files as 'changed' when they aren't. Every time WinSCP checks the remote folder it will detect 1200+ changed files when in reality only 3 or so have changed. It will download all of those 1200, then check remote folder again and detect the number of files as 'changed', downloading them all again. Note that the number of 'falsely changed' files can differ on every remote check, varying between ~900 and ~1300 files. The total number of files + folders in the remote directory is ~2470. This cycle of false-positive change detection continues endlessly, downloading thousands of files insteads of the 2 or 3 that it should.
I've tried re-installing the WinSCP, deleting the server bookmark and making a new one, and running WinSCP as admin. None of these work.
I'm connecting to a remote server via FTP protocol, without encryption.
--Update to Martin Prikryl--
Two sessions have been logged, download these logs here.
A few notes:
I tried running this on a subfolder called 'archive-08-2020' to limit logsize, but I couldn't reproduce the problem. This subfolder did a full sync of it's ~800 files, but noticed no changed files after the first sync round. Hence the two WinSCP logs are from operations on my main, large folder. Sorry for this inconvenience.
On both sessions, the logfiles have iterated over all files in the folder several times already while the PowerShell screen is still working on the first run of downloading all of them in order.
The files in the remote folder start at chatlog_2020-09-01_0121.txt but the PowerShell window only starts at chatlog_2020-10-25_0334.txt each time, even on consecutive iterations within the same session. WinSCP session log also starts at chatlog_2020-09-01_0121.txt.
The remote folder has 4 subfolders: archive-05-2020 through archive-08-2020. The archive-08-2020 files are logged in the WinSCP session log, but none of the other subfolders are.
One example of a file that should not have updated but still did is chatlog_2020-11-30_2210.txt
It seems that the timezone offset autodetection fails with your particular FTP server for some reason. It may started failing with end of daylight saving time in October?
Try to disable the timezone offset autodetection at the Environment page of Advanced Site Settings dialog. Try setting it to 0:00.

JMeter - No root certificate found in bin directory

I am trying to record a Script using Jmeter recorder. For this I tried to import root certificate from the bin folder in Firefox. But I can't see a certificate there. I also tried to download sample JMeter certificate from GitHub and installed it. But Firefox rejected it saying that I do not have the corresponding private key.
Could anyone please tell why is my certificate missing? Also it would be helpful if someone could tell me how to generate the certificate in Jmeter.
My Java version is "1.8.0_251"
JMeter version - 5.3
The certificate is being generated under "bin" folder of your JMeter installation when you start HTTP(S) Test Script Recorder, to wit when you click "Start" button:
Before that you will not see any certificate.
The certificate file is ApacheJMeterTemporaryRootCA.crt and it will appear assuming your properly installed Java and this guy can be installed into Firefox browser ("Authorities" tab of the Firefox Certificate Manager)
Don't download any certificates from Internet and if you did - don't install them as you're putting yourself under the risk of MITM attack, use only the certificate your very own JMeter generated
Also be aware that there is an alternative (easier?) way of recording a JMeter test: JMeter Chrome Extension, in this case you won't have to worry about proxies and SSL certificates.

open recent option disabled in jmeter

When I open jmeter, the load file option that is open recent file is not working.It is disabled.What should I do.I tried deleting jar files one by one in lib folder but it did not help. I am using jmeter version 4
JMeter uses Java Preferences class to store the list of recently opened files
On Windows "Recent Files" are being stored under the following path in Windows Registry
Computer\HKEY_CURRENT_USER\Software\JavaSoft\Prefs\org\apache\jmeter\gui\action
On Linux most probably it would be:
~/.java/.userPrefs
On MacOSX it should live under:
~/Library/Preferences/com.apple.java.util.prefs
Your user must have access to this location (i.e. you may have to run JMeter as Administrator once) to get the storage created. On Linux/Unix systems the user should have read/write permissions to the given location.
If preferences don't exist or are empty - you will not be able to see anything.
Given you mentioned you deleted files from "lib" folder you might remove something critical by accident which may cause JMeter malfunction. So consider reinstalling JMeter from downloads page and re-installing missing plugins with dependencies using JMeter Plugins Manager

Error on opening jmeter script

Whenever I'm trying to open jmeter script then it's showing the following error.
I already kept plugging in lib/etc folder but the error is still there. Please provide me the solution of this as soon as possible.
Sometimes file is corrupted, you should save your file before executing, JMeter save latest file,
Try open latest file saved in backups folder.
Since JMeter 3.0, JMeter automatically saves up to ten backups of every saved jmx files.
Next version backup will be saved automatically on every run.
Check all plugins are there. do you have a copy of the error message as they should help understand which plugin is the issue "missing".
Also if you have downgraded jmeter then you will also have an issue opening newer jmx files and they cant be opened by older versions.
So maybe a long shot but download the latest version and add your plugins in and try to open the jmx in that.

Selenium + Firefox + HTTPS

Okay. I know that I am asking a hackneyed, overchewed question but I am posting this because my problem is not getting solved despite trying all the solutions provided on various links.
My constraint - I don't want to use a saved firefox profile to save the website's certificate.
Selenium server version - 2.0b3
Solutions tried -
1) http://seleniumhq.org/docs/05_selenium_rc.html#handling-https-and-security-popups
Browser launcher *firefox
Selenium started with trustAllSSLCertificates option.
Did not help. FF again asks to save the certificate.
2) http://blog.mogotest.com/2010/04/13/how-to-accept-self-signed-ssl-certificates-in-selenium/
Browser launcher *firefoxproxy
Selenium started with trustAllSSLCertificates option.
Did not help.
3) Selenium Testing HTTPs Trust All certificates working for FF but not IE
4) Besides that I tried creating my own cert_override.txt and populating the 5 fields as explained in https://developer.mozilla.org/En/Cert_override.txt but getting the value for the 5th field which is the certificate's serial number and the issuer name as a base64 encoded string is not straightforward as explained in http://tinyurl.com/ce4vn99.
5) Using the Remember Certificate Exception addon for Firefox http://sejq.blogspot.in/2009/01/remember-certificate-exception.html is yet another option but I have not been able to do a full silent install of it. When we drop the xpi file in the required directory, the next time Firefox starts, it will prompt saying that should it found the addon and should it go ahead and install. The addon won't just get reflected in the browser. If anyone can atleast help me with a FULL silent install of this, it would be great!
All I want is that this works in Firefox. I am not interested in IE and Google Chrome.
Any help in providing an answer and not just terming this as a duplicate would be greatly appreciated.
I would suggest an alternative to Selenium.
Have you tried Sahi? It's basically a very similar application, in that it allows scripted browser control, but for a lot of cases it seems to work better than Selenium.
From the Sahi FAQ page:
How does it compare to Selenium?
Sahi is easier to learn and use for testers. Sahi’s recorder works on all browsers. Sahi automatically waits for AJAX and page loads. It does not use XPaths, but uses more intuitive APIs like _in and _near. Sahi works well across frames, iframes, popup windows, sites with dynamic ids, https sites, 401 authentication sites etc. It has inbuilt HTML reports, and ability to run multiple scripts in parallel.
In my experience, this is accurate. There are certain types of browser event that Selenium struggles with, that Sahi handles much better.
I know that doesn't solve your problem with Selenium, and I know it's a pain if you've already written your tests in Selenium to re-do them in Sahi so it may not be the solution you're looking for, but if all else fails, it may be worth considering.
ps - you didn't mention anything about your development environment, but there is a PHP-based testing tool called Mink which integrates with both Sahi and Selenium -- ie you can write the a single test script and have it work in either. I don't know of any similar tool in other languages, but it might be of interest if it helps you migrate between the two.
So the solution turned out to be the 5th point mentioned above.
Here are the steps to solve the issue -
1) Download the Remember Certificate Exception xpi file from https://addons.mozilla.org/en-US/firefox/addon/remember-certificate-exception/
2) Unzip it to get a set of files. Keep them in a temporary folder. (temp_folder/extracted_files)
3) Open the install.rdf file and copy the content of em:id node present in the Description node.
4) Rename the temporary folder just created with this copied string.
5) Place this folder under the profile_name/extensions/ directory. Also delete the extensions.cache/.ini/.rdf files from your profile folder. These need to be deleted so as to prevent the user from being prompted that his profile has been changed and that there is a new addon to be installed. Only if the 3 files are deleted, it will be a fully silent install.
This can be automated using a script.
#!/bin/bash
mkdir /tmp/addon
cp -r ~/POC/remember_certificate_exception-1.0.0-fx.xpi /tmp/addon
unzip /tmp/addon/remember_certificate_exception-1.0.0-fx.xpi -d /tmp/addon
rm /tmp/addon/remember_certificate_exception-1.0.0-fx.xpi
folder_name=$(cat /tmp/addon/install.rdf | grep -m 1 "<em:id>" | cut -f2 -d ">" | cut -f1 -d "<")
mv /tmp/addon /tmp/$folder_name
cp -r /tmp/$folder_name ~/.mozilla/firefox/*.default/extensions
rm -f ~/.mozilla/firefox/*.default/extensions.
https://addons.mozilla.org/en-US/firefox/addon/skip-cert-error/
Use this addon. This will bypass the https errors. This is configurable as well
I've put together an example that shows how to use Selenium to test HTTPS endpoints -- without ignoring certificate validation errors. It shows how to setup the selenium clients with trusted root CAs that can be used to validate the server certificates presented by the HTTPS endpoints being tested. See https://github.com/JeNeSuisPasDave/Selenium-and-TLS
The example demonstrates Chrome and Firefox Selenium nodes. Chrome looks in the system trusted certificate store for root CA certs used for validation; Firefox looks in the cert8.db file within the current profile.
I think this approach is important because I think that instructing your test harness to ignore certificate errors is unnecessarily risky; doing so may eventually hide errors that you wish you had trapped before they got deployed to production.
I wrote an short post about this topic, https://develves.net/blogs/asd/2017-02-20-selenium-and-tls/, but you really just need the example repo linked above.

Resources