sharing config elements between different test plans - jmeter

In JMeter I have different Test Plans that use webservices from the same provider. Because of provider's configuration I have to add same Config Elements in each of my Test Plans. Is there any way I can share Config Elements, so that there is no duplication?

You can share by reading same file with CSV Data Set Config
Use Property File Reader plugin
Read properties file via Beanshell Sampler:
FileInputStream is = new FileInputStream(new File("d:/somefolder/somefile.properties"));
props.load(is);
is.close();
add -q option to load another property file

Related

Springboot- reload property values without server restart

I have a springboot application and an application.properties file from which the values get fetched when the application runs. I am finding a solution to change the property values and reload it without server restart.
Using spring-cloud-config is a solution I know, but I cant use the cloud config in our application . Please suggest if there is any other way to reload the property files using springboot.
You can use archaius available at https://github.com/Netflix/archaius.
Here is how you use it.
DynamicStringProperty property = getDynamicPropertyFactoryInstance()
.getStringProperty(key, StringUtils.EMPTY);
You will have to create a wrapper now to read all values from config.properties file. Archaius reads and returns updated values from config.properties file by default.

How can I provide multiple folders using bean shell pre processor to read files using jmter thread

How can I provide multiple folders using bean shell pre processor to read files using jmter thread?
I tried to upload multiple files using bean Pre processor and Http request sampler sending all files present is folder provded for one thread.
If I do have different folders for different thread it is requred to provide dynamic path/parameterized path for bean pre processer.
I want to make dynamic path for 'path_to_your_folder'
bean shell pre processor configuration:
Bean Shell pre processor configuration image as below
You can parameterize file path using CSV data set config and use the parameter in your beanshell..
Create a CSV file containing all paths.
Add a CSV Data Set Config to your test plan and configure your CSV ,give variable name as shown below
In your pre-processor you can use vars.get("Variablename") to get file path as shown below
For more info on beanshell please read this article.
however its recommended to use JSR223 sampler with groovy as the performance is much better compared to beanshell..
Please let me know if it helps

OpenLiberty Microprofile configuration example?

How can I pass MP config property file to OL on the command line? The wlp/bin/server.bat does not allow to pass even Java system properties...
I have looked at the OL MP config example and it assumes that the configuration is in the user user.home system property - not very useful.
I read the various WS Liberty docs and they require me to configure in XML the location where the property file is - also not very flexible. Other options involve using environment variables - not what I want.
What I want is something as flexible as:
bin/server.bat -Dmy.conig=c:/temp/myconfig.properties
This example above is similar to how Spring/SpringBoot does it. Thanks!
There are a few solutions for your use case:
Use your properties file as the default config in the app by placing your file inside the app under META-INF\microprofile-config.properties for jar or WEB-INF\classes\META-INF\microprofile-config.properties
Use your config as default jvm properties by using the instruction provided by covener. You can put the content of myconfig.properties into jvm.options or just rename your file to be jvm.options but place under one of the locations mentioned by covener.
Use your properties file as a custom config source. You can directly implement MicroProfile config api ConfigSource to parse this property file and provide the name value pairs for your app.
You can find more info about MicroProfile config from the open liberty guide (https://openliberty.io/guides/microprofile-config-intro.html)

Get all config files with spring cloud config

I am relatively new to spring cloud config and I am able to pull the config file with the application name. There is a need for me to pull all the config files from Git via Spring Cloud Config without having to know or pass the application name in the context.
Currently I have used "spring.cloud.config.server.git.searchPaths= *" in my bootstrap file to search my entire git project and using "/{application}-{profile}.properties" to pull the properties files matching the application file. Would want to pull all properties files without passing this application name, is this possible?
I would require this logic to know how many properties files are checked in and how many are duplicates and this logic will be handled by my custom REST service that I am planning to write.

JMeter with Custom Java Code

I am new to JMeter and trying out certain sample code as part of my POC's. My requirement is pretty simple, I just need to attach a zip file to a SOAP message and fire the request. But to create the SOAP message we already have a framework that needs to be used. Now the problem I am facing is to include the framework JARs. I tried to add the library files into the project and create a JAR and paste it in /lib/ext folder and also by putting them in the class path. None of this works.
How do you use any existing framework JARs with the custom code you write for JMeter??
Drop your jar to /lib folder of your JMeter installation
Restart JMeter. JMeter doesn't pick up new libraries or configuration file changes dynamically.
In Beanshell or JSR223 Sampler refer to your jar classes as:
import com.yourcompany.package.SomeClass;
import com.yourcompany.package.SomeMessage;
SomeClass myClass = new SomeClass(parameter1, parameter2);
SomeMessage message = myClass.createMessage();
message.send();
See WebSocket Testing With Apache JMeter guide as an example of using external jars in JMeter.

Resources