How to display the values set by the karate-config.js file in the karate report? - karate

I want to display the value of variable name set in the js file in the karate html report. What should I do? Who can answer me? Thank you
For example, the "baseUrl" in the report is set in karate-config.js. I want it to display the value I set in karate-config.js

Just do this on the first line:
* print 'baseUrl is:', baseUrl

Related

How to parameterize values in the csv file which is already parameterized in Jmeter

I have multiple API request bodies and Im passing them using txt file in CSV Data Set Config. This API request bodies have certain values to parameterize. How Do I acheive this? something like paramertize inside parameterized csv file.
If your CSV file contains JMeter Functions or Variables which you want to evaluate in the runtime you need to wrap the variable(s) defined in the CSV Data Set Config into __eval() function
For example if you have:
test.csv file with the single line containing ${foo} and CSV Data Set Config reading this file into some-variable
User Defined Variables which assigns the variable foo the value of bar
And a couple of Debug Samplers for visualization
You will see that:
${some-variable} will return ${foo}, basically the line from the CSV file
${__eval(${some-variable})} will return bar because the variable will be evaluated and its respective value will be resolved.

JMeter - testing unique links taken from CSV file

I want to test unique link taken from csv file in Jmeter. I have a csv file with unique values - "value 1", "value 2" .....
For each thread, I need to append it as part of url(or path).
Ex: BaseURL: example.com
For thread 1, example.com/value1
For thread2, example.com/value2
How can I do this in JMeter? Any help will be highly appreciated. I have created CSV and all. Just need to know how to take that value and set as part of path.
Put your "base url" into "Server name or IP" tab of the HTTP Request Defaults:
Configure CSV Data Set Config to read the values from the file and store them into a JMeter Variable
Use the variable from the step 2 in "Path" field of the HTTP Request sampler:
That should be it, each thread will read the next value from the CSV file on each iteration:
Demo:
In CSV Data Set Config add path as Variables Names, use Sharing mode All Threads
In HTTP Request Path field add ${path}
Each thread will send a different path taken from CSV line

Write Batch variables to the filename

i have a problem with batch and i can´t find the answer. I want to write a variable into the name of a file, that will be created. :) I want to make a Joomla Helper Batch. It should generate a grid for Modules. It is only for my purposes.
This is my example code.
#echo off
set /pmodulename = Please insert the name of the Module:
echo ^<?xml version^=^'1.0^' encoding^=^'utf-8^' ?^> ^<extension type^=^'module^' version^=^'3.0^' client^=^'site^' method^=^'upgrade^'^> > "%modulename%".xml
After executing the batch file, there is a xml file, but it has no name. So how can i append the variable name to the file?
Greetings
Kevin Grahn
Looking at that you have a space before the = remove that and it should be fine
Before:
set /pmodulename = Please insert the name of the Module:
After:
set /pmodulename= Please insert the name of the Module:
Just run your line in a cmd window then run set to see the list you will see the variable has the space.

How to upload image through JMeter?

I have a website which needs to upload multiple images at a time. So I want to know what is the process of posting image file through JMeter?
You'll need the following:
In HTTP Request Sampler:
Select "POST" method from drop-down.
Check "Use multipart/form-data for POST" box
Provide correct input name, MIME type and path for the file to be uploaded.
See Upload and Download Scenarios with Apache JMeter guide for more details.
If you need to upload multiple images best option is to go for a CSV Data Set Config element in Jmeter.
First, add the full path of the images you want to upload comma separately in a file (.csv) as below.
eg: D:\User\Images\img1.png,D:\User\Images\img2.png
Then, add a CSV Data Set Config element most preferably to the top of the script
Next, configure the below elements in the CSV Data Set Config element
Filename: full path to the csv file
Variable names: “column name” in the csv file if you have added one or any variable name if you don't have a column name (eg: images)
Note: Make sure to change the delimiter and other optional parameters as required.
Finally, in a HTTP Request you can use the parameter ${images} to call the images. The CSV Data Set Config element will read the image names from the CSV file and set them in the variable called "images".
Refer the below guide for more information.
https://www.blazemeter.com/blog/how-test-image-upload-functionality-jmeter

How to add variable names to the JMeter CSV output file?

I'm using JMeter for performance testing and generate an CSV file for data analysis.
How should I add JMeter Variable names to the CSV output? It seems that only pre-defined columns can be added (see screenshot).
This is my log-file:
14/03/2014,Login,OK,982
14/03/2014,Search,OK,2182
14/03/2014,Login,OK,3982
I would like to add a column with the ${username} to generate something like:
14/03/2014,Login,OK,982,user1
14/03/2014,Search,OK,2182,user7
14/03/2014,Login,OK,3982,user9
Try to pass sample_variables property, for example as command-line parameter -Jsample_variables=username,some_other_var
Also see FlexibleFileWriter plugin if you need custom formatting http://jmeter-plugins.org/wiki/FlexibleFileWriter/?utm_source=jmeter&utm_medium=helplink&utm_campaign=FlexibleFileWriter