How to use include controller in test plan level - Jmeter - jmeter

I have a question in Jmeter that I want to resolve.
I am trying to create configuration package for each environment that I am working on.
for example:
1. Staging
2. QA
3. Production
I have configurations of each environment with its DB and servers.
I want to save then to test fragment and then with a single button to switch properties, just to select the configuration for each env.
The problem is that Jmeter not allow to add include installer at test plan level, how can I resolve it?
Provided a pic that demonstrates what I try to do
I want that configuration fragment (that saved all the properties of DB and server) will be at test plan level.
I have 3 fragments
1. configuration - My SQL + Vertica + Server of QA ENV
2. Configuration Prod - My SQL + Vertica + Server of production ENV
3. Configuration Stg - My SQL + Vertica + Server of staging ENV

I don't think you need to have 3 separate configurations, one will be sufficient. Example setup:
Add User Defined Variables element to the top of Test Plan
Define your variable there using __P() function like:
Create file qa.properties with the following line:
foo=bar
Create file stag.properties with the following line:
foo=baz
If you run your JMeter test like:
jmeter -q qa.properties -t test.jmx
${foo} variable value will be bar
If you run your JMeter test like:
jmeter -q stag.properties -t test.jmx
${foo} variable value will be baz
I believe this way is way more faster, convenient and flexible. Check out Using User Defined Variables article for more information if needed

Related

Additional property files to load in JMeter

My performance test setup
Jmeter 5.3
1 JMX File that contains my test plan.
1 default properties file. This is named 'user.properties'.
1 custom properties file. I pass this when I run my test plan headless.
I have a test plan that I run in the following ways,
headless
jmeter -p "customProp.properties" -n -t "myTestPlan.jmx"
GUI
Open > myTestPlan.jmx and like above I want the customProp.properties also to come into effect with myTestPlan.jmx in play.
What I've done so far?
I've used the 'user.properties' attribute within the 'user.properties' file in the bin directory as follows,
user.properties=customProp.properties
I know how to do add properties files when running headless. Just now sure how to do it with GUI. Any pointers?
Just proceed as for Non GUI, but note it’s better to make -p point to jmeter.properties and -q to user.properties and your additional properties file:
jmeter -p path_to_jmeter.properties -q path_to_user.properties -q path_to_custom.properties
See:
https://jmeter.apache.org/usermanual/get-started.html#options
If you don't have any customizations under user.properties file and don't plan to have them in the future - locate the following line in the jmeter.properties file:
user.properties=user.properties
and change it to point to your "custom" properties file:
user.properties=customProp.properties
it will make the change permanent and you won't have to play with command-line arguments no matter whether you run JMeter in GUI or non-GUI modes (JMeter restart will be required to pick the properties up)
More information:
Configuring JMeter
Apache JMeter Properties Customization Guide

How do I change a promotion strategy in one of my Jenkins X environments?

I've used the "jx create spring -d web -d actuator" command to create a simple Spring java application but I can't figure out how I'd change the promotion strategy from Auto to Manual. Can't see how it's being set in the environment configuration.
https://jenkins-x.io/about/features/#promotion
you can use jx edit env to edit your Environment configurations. Or you can use kubectl edit env staging if you want and edit the custom resource directly.
See: https://jenkins-x.io/commands/jx_edit_environment/

multiple parameters not getting passed when I start my spring boot application in command line

I want to override certain properties during deployment of my spring boot application.
when I try the following it works
sudo /etc/init.d/myapp start --app.env=prod
I see the app.env is correctly set to prod (my /health just echoes this values)
however when I set more than one property it did not work,
sudo /etc/init.d/myapp start --app.env=prod --version=2.3.4
I see only app.env is correctly set. the version value is not overridden.
why is it so? what is the right way to pass multiple parameters.
NOTE: I want to pass username and password for datasources. but for testing purposes, I kept it simple to override these properties.
You would want to read the section around Customizing the startup script. Specifically that you can include a myapp.conf file beside the jar file. In that .conf file is a JAVA_OPTS variable. You would then use -Dapp.env=prod -Dversion=2.3.4

Automatically running the same test plan multiple times with different variables

I've created a test plan to do some load testing against HTTP endpoints. I want to run the same test plan against multiple endpoints, and find myself having to do the following each time:
Change variable that determines which endpoint I'm hitting.
Run the test.
When complete, record results.
Clear all results.
Back to step 1.
I want to automate this. Is the following possible?
Define a list of endpoints as a variable.
For each endpoint in endpoints
Run test against endpoint
When complete, save results
Clear all results.
The things in particular that I don't know how to automate are:
Starting a test
Defining an list-style variable
Clearing all results
Any help would be greatly appreciated!
Please see answers below:
Starting a test
Apart from running JMeter from GUI there are several execution options such as:
Command line non-GUI mode - you can wrap JMeter execution line in operating system batch file
JMeter Ant Task - integration with Apache Ant build system, more powerful if you're comfortable with it
JMeter Maven Plugin - the same as Ant but for Apache Maven
Option to run JMeter with CI systems like Jenkins
Defining an list-style variable
JMeter offers "properties" which can be set via .properties files (see user.properties in /bin folder of your JMeter installation for example) or passed as name/value pairs to JMeter startup script. For instance instead of hard-coding your host in .jmx file you can use read a property function.
Set "Server Name or IP" field value to ${__P(myhost,)}
Add myhost=example.com line to user.properties file in /bin folder of your JMeter installation, restart JMeter and run the test. Request will go to example.com.
Alternatively you can pass myhost property to JMeter in command-line mode as follows
jmeter -Jmyhost=example.com
Multiple properties can be passed this way:
jmeter -Jproperty1=value1 -Jproperty2=value2 ....
And even files via -p or --propfile JMeter command line argument
See Apache JMeter Properties Customization Guide for more options and information.
Clearing all results
It depends on unattended execution option you'll choose, all of them provide at least one way to delete file and/or folder. Personally I wouldn't delete any results and would rather keep them for future reference. To distinguish different endpoints test runs and to avoid overwriting I would use timestamps like:
jmeter -Jhttp.endpoint=my.test.host -n -t your-script.jmx -l my-test-host-results-${date}.jtl
where
-J - sets endpoint to my.test.host
-n - tells JMeter to run in non-GUI mode
-t - specifies .jmx file to use
-l - specifies name and location of results file

Accessing Meteor Settings in a Self-Owned Production Environment

According to Meteor's documentation, we can include a settings file through the command line to provide deployment-specific settings.
However, the --settings option seems to only be available through the run and deploy commands. If I am running my Meteor application on my own infrastructure - as outlined in the Running on Your Own Infrastructure section of the documentation - there doesn't seem to be a way to specify a deployment-specific settings file anywhere in the process.
Is there a way to access Meteor settings in a production environment, running on my own infrastructure?
Yes, include the settings contents in an environmental variable METEOR_SETTINGS. For example,
export METEOR_SETTINGS='{"privateKey":"MY_KEY", "public":{"publicKey":"MY_PUBLIC_KEY", "anotherPublicKey":"MORE_KEY"}}'
And then run the meteor app as normal.
This will populate the Meteor.settings object has normal. For the settings above,
Meteor.settings.privateKey == "MY_KEY" #Only on server
Meteor.settings.public.publicKey == "MY_PUBLIC_KEY" #Server and client
Meteor.settings.public.anotherPublicKey == "MORE_KEY" #Server and client
For our project, we use an upstart script and include it there (although upstart has a slightly different syntax). However, if you are starting it with a normal shell script, you just need to include that export statement before your node command. You could, for example, have a script like:
export METEOR_SETTINGS='{"stuff":"real"}'
node /path/to/bundle/main.js
or
METEOR_SETTINGS='{"stuff":"real"}' node /path/to/bundle/main.js
You can find more information about bash variables here.

Resources