JMeter's JSR 233 - Edit option in language is irrelevant - scripting

In JMeter JSR 233 element There's an Edit option in language Combo box,
If you leave empty it chooses by default groovy, but if you write engine name it's error prone and irrelevant because according to previous question
drop down is being populated on-the-fly using
ScriptEngineManager.getEngineFactories() method which performs
discovery of available scripting engines in JMeter Classpath.
So if you can choose in drop down only relevant engines why you need to input manually different (not working) engines?
Is it a bug of JMeter? or is there a special reason/usage?

The edit option comes from the fact that a generic combo box component is used for the GUI of this element.
One possible case I see is user having some engine in JMeter install A.
He saves his script.
He opens it with JMeter install B where this engine is not installed, if this option didn't exist, he would lose this setting.

Related

SSRS - "Print We'll create a printer-friendly PDF version of your report."

All Reports when click the print button open a PDF option with
but I want to print straight to the print.
I've tried to change a few configurations on SSRS but does not work, my research so far:
https://learn.microsoft.com/en-us/sql/reporting-services/report-server/enable-and-disable-client-side-printing-for-reporting-services?view=sql-server-2017
This thread and its linked pages answers the challenge completely
https://social.msdn.microsoft.com/Forums/en-US/5a631f79-a116-49b7-8f55-826c050a38ce/printing-from-ssrs-2016-dirrectly-to-printer-without-pdf-reader?forum=sqlreportingservices
http://printssrsreport.blogspot.com/
https://neelb.wordpress.com/2018/09/26/ssrs-enable-disable-client-side-printing/
Microsoft has intentionally limited direct printing without intervention for good reason.
In all scenarios printing reports is bad -- data is out of date immediately, paper wastage, print server administration (and automation if you go down that route)
Reading through the noise - Chrome browser offers a marginally better experience because it has an inbuilt PDF viewer - so the user experience would marginally better than having to open a separate application to view the PDF - from Chrome the facility to print the PDF is trivial
To achieve this, you need to do some programing using c#. I am not sure that you have this option available for you or not. In case, if you would like to see how it that code looks like refer below link. This might help. Even you can setup default printer and pass parameters like username, date range etc. I was looking for a way to set default printer using code and found this link.
ReportExecutionService

How to find all places where variable is used in JMeter scenario?

I use JMeter to record HTTP scenario and do load testing. Now I need to correlate some values using Regular Expression Extractor, for example ${secure_id}, but I don't know how to find all requests where this variable is used. I can substitute this step by step, but it is necessary for me to do it automatically in all places where it is used. Thanks for any answer
You could open your TestPlan.jmx file with text editor notepad++ for example and find+replace all occurrences of ${secure_id} here is an example
Have you seen "Search" option in JMeter's main menu? It's available since JMeter 2.9 if not earlier
As #Boyan suggests JMeter scripts are XML files so you can use your favourite text editor for bulk replacing hardcoded recorded value with the variable
You can use a 3rd-party recorder which has SmartJMX mode. The main feature is automatic correlation of any detected entities. See How to Cut Your JMeter Scripting Time by 80% for details.

How to write a script that interacts with web browser and print content as PDF?

I'm looking to write an automated script that
Opens up a browser instance with a specific URL
Print the page as PDF output to a pre-defined location and document name
Simulate a click event on the web page that goes to the next report
Repeat 2 and 3 for a fixed number of times.
I'm not sure how to start doing this. Thought of using Javascript, but it won't be able to automate the printing process.
There is no control of the server, therefore I cannot use a query to get the collection of those reports.
The reason for the script is that there are many such reports, and the server can be very slow at times, it would be better to have them locally.
UPDATE: Forgot to mention that log in is required for the server.
I think scripting an off-the-shelf browser is very much the Hard Way to solve your problem. If you can at all predict the URLs for the individual report, use a command-line tool such as wget or curl to download them, and then look at this community wiki for rendering the downloaded HTML as PDF.
Or do you even need to go to PDF? If all you're interested in is having the reports available locally, why not keep them as HTML and view them in a browser (with a file: URL) rather than a PDF viewer?

Generate and Save the files automatically to my local disk using Selenium

I have a Report Generator which is an intranet web application generates some reports. There are about 100 reports. Those reports are of PDF and Excel type. And I want to ensure that all these reports are generated without any issue. This is a daily job.
Each report takes an average of 2 min. Manual checking process takes 200 min.
As this is a testing process and not bothered about the contents in the files I want to automate the process.
We are using Selenium test cases to test our web application.
Is there any way to Save these reports on my location disk using Selenium ?
To answer your question, no. Browsers won't allow it, unless a user chooses to upload. But even if there is a way, i would advise against using it.
Even if you can do this by any means its HIGHLY NOT RECOMMENDED
This will be a huge security threat and it won't be allowed. Javascript is inside a security sandbox and won't allow these kind of things.
What if the server is sending a potentially dangerous file that might affect the client system?
See JavaScript security
At best, you could display the file download prompt. The browser's security (and common sense :)) won't allow you to do anything more. If you absolutely must do unsupervised file downloads, you could use some kind of ActiveX, or a Java applet.

browser plugin to test a site's look when migrating

I'm thinking I need a browser plugin that does the following, and if it doesn't exist, it should. I may as well say FF for now, but it could be any browser.
The problem: when moving a website from one server to another, you need migration testing. It is a pain to click on every link by hand and compare it to the old host. You really need 2 machines or have to constantly thrash your hosts file.
The plugin:
Would allow you to specify an alternate hosts entry for a website. 2 entries would make it clear, one for live, one for test.
The plugin would crawl every link on the site, and render the page in the browser, and save an image of the entire page.
It would switch hosts and repeat, and save images in a second folder. Since the rendering engines match, the images should match. We need to switch hosts (like /etc/hosts) so all absolute links are the same for the site.
Now this could be part of the plugin or external, now that we have 2 folders of identically named images, we run an image-diff program on the whole batch. A quick test would be a bdiff or hash, or we could get more sophisticated and determine how different each image is.
This would save so much time. So can it be done with existing tools, or do I need to go write it?
Have a look at Selenium, it allows you to script interactions with the browser and verify content.
That is overengineered. What kind of website is it? How big? Which framework (PHP, JSP, Rails, etc.)? Why not copy the website onto the new server and grep the code for specific ties to the old server?
I'd concentrate on why you think the site would differ between two servers, and focus on testing those specific cases rather than the whole site. When a site is moved to a new machine the issues are generally very obvious from looking at a couple of pages.
Presumably they are both looking at the same data source, assuming there is a data source, otherwise a folder diff on the two installations would suffice. This being the case, it should be a simple task to identify which areas of the site are likely to be affected by a server migration.
Also, I wouldn't personally trust a machine matching two images to sign off system as ready to go live. There just isn't a substitute for real human testing. Yes it's time consuming, but how important is your site?
Try http://www.browsercam.com/ - free trial should allow you to specify main page and follow links to make screenshots automatically of the sub-pages as well.