How do i generate the results CSV ,jtl files automatically with the date and time format?
Basically what i am trying to looking for generating the Test results files CSV and jtl files automatically with the date and time stamp and pass that results file in the Graphs Generator , so that I don't need to keep modify the jmx files.If possible Graphs output folder also with the date and time stamp.
How do I achieve this?
please see the below screenshots
2017/04/05 16:07:49 INFO - jmeter.engine.StandardJMeterEngine: Running the test!
2017/04/05 16:07:49 INFO - jmeter.samplers.SampleEvent: List of sample_variables: []
2017/04/05 16:07:49 ERROR - jmeter.engine.PreCompiler: invalid variables org.apache.jmeter.functions.InvalidVariableException: Expected } after __time function call in C:\JMETER\LR2JMeter\NGP\Results\NGP_PensionReport\PR_ViewResultsTable_${__time(YMDHS),}.csv
at org.apache.jmeter.engine.util.FunctionParser.makeFunction(FunctionParser.java:139)
at org.apache.jmeter.engine.util.FunctionParser.compileString(FunctionParser.java:82)
at org.apache.jmeter.engine.util.CompoundVariable.setParameters(CompoundVariable.java:189)
at org.apache.jmeter.engine.util.ReplaceStringWithFunctions.transformValue(ReplaceStringWithFunctions.java:46)
at org.apache.jmeter.engine.util.ValueReplacer.replaceValues(ValueReplacer.java:170)
at org.apache.jmeter.engine.util.ValueReplacer.replaceValues(ValueReplacer.java:80)
at org.apache.jmeter.engine.PreCompiler.addNode(PreCompiler.java:78)
at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:996)
at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:997)
at org.apache.jorphan.collections.HashTree.traverse(HashTree.java:978)
at org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:306)
at java.lang.Thread.run(Unknown Source)
Please advise me!
Thanks,
Rajani
Use below syntax to name your file. You can use this cheat sheet, if you want to change the format.
For more details about functions, please check this link.
${__time(MM-dd-yyyy-HH-mm-ss,)}
Related
I have added full device information in CSV file and here device information:
{"IpAddress":"fec0::15:b2ff:fe00:0fec0::ac6b:8271:fa94:818c192.168.232.2fec0::10bf:85ff:fe05:9ec1fec0::a1f6:b9e4:fd47:4b15192.168.200.2","BuildVersion":"1.0","DeviceManufacturer":"Google","DeviceOS":"android","DeviceVersion":"28","IMEINumber":"358240051111110","NetworkCountryISO":"us","PhoneNumber":"","SIMCountryISO":"us","SIMSerialID":"89014103211118510720","SIMState":"5","UUIDNumber":"eda5b585a146e41d"}
which I passed in a CSV and when I run this code every time it's give me error because full device info is not passing. Please help me how to solve this issue.
Thank You.
CSV stands for comma-separated values and there are 11 commas in your "full device info" so the options are in:
Change the "delimiter" in the CSV Data Set Config to some character which is not present in your test data, for example |
Use __StringFromFile() function which reads the next line from the file each time it's being called directly in the relevant Sampler
I used the ${__time()) function to convert the current time into a timestamp value in seconds.
The result I got was formatted like 1.543425678e9 instead of 1543425678.
My API doesn't accept this format. Can anyone help me out here?
example of setup function and store as variable
result in debug postprocessor:
time=1557263114733
Can you describe more detail about how you are using this function? Where are you seeing the output in the incorrect format?
During my JMeter test I am extracting a float value from the response message an saving it to a variable using Regular Expression Extractor, and I am also saving that value in the generated test result csv file. Now I want to be able to generate a graph of this extracted float value, but haven't figured out a way to do so, or have found and examples to create my own graph plug in to graph this value.
In next version of JMeter 5.0, you’ll be able to do that bu adding in user.properties this:
sample_variables=VarName
jmeter.reportgenerator.graph.custom_mm_hit.classname=org.apache.jmeter.report.processor.graph.impl.CustomGraphConsumer
jmeter.reportgenerator.graph.custom_mm_hit.title=Graph Title
jmeter.reportgenerator.graph.custom_mm_hit.property.set_Y_Axis=Response Time (ms)
jmeter.reportgenerator.graph.custom_mm_hit.property.set_X_Axis=Over Time
jmeter.reportgenerator.graph.custom_mm_hit.property.set_granularity=${jmeter.reportgenerator.overall_granularity}
jmeter.reportgenerator.graph.custom_mm_hit.property.setSampleVariableName=VarName
jmeter.reportgenerator.graph.custom_mm_hit.property.setContentMessage=Message for graph point label
In above example:
VarName is the name of your variable
custom_mm_hit would be a unique id for your graph, you should change it but always prefix with "custom_"
To configure and generate graph see:
https://jmeter.apache.org/usermanual/generating-dashboard.html
You ‘ll get a new Graph of value over time in Custom Graphs section.
To download nightly build which is stable snd will be very close to 5.0, see:
https://jmeter.apache.org/nightly.html
You can use Sample Variables property to save your float value into .jtl results file
Add the next line to user.properties file:
sample_variables=foo
Replace foo with your actual JMeter Variable Reference Name from the Regular Expression Extractor
When you run your test next time you will see an extra column in the .jtl results file holding your float variable value. Another option is setting this property via -J command-line argument like
jmeter -Jsample_variables=foo -n -t test.jmx -l result.jtl
See Configuring JMeter and Apache JMeter Properties Customization Guide articles for more information on tuning your JMeter engine using properties.
Once you get the value stored you can plot the chart using LibreOffice Calc or Microsoft Excel or equivalent.
If you want to come up with a plugin to plot the custom variable you can start with How to write a plugin for JMeter guide and then look into source of i.e. Latencies Over Time plugin which lives in GitHub
I am trying to get the issues(bug,codesmells) through sonar API by using the following
/sonar/api/issues/search?pageSize=1&projectUuids=AV7s-_ldd2-CFpJxZLc4&types=BUG&createdAt=2017-11-08&resolved=false
Its working well, But what I am looking here is, instead of giving the date manually, Is it possible to pass the date which I will get it from script?
My codes :
wget.download('http://00.00.00.00:9090/sonar/api/project_analyses/search?project=project-id',out='file1.json',bar=None)
data = json.load(open('file1.json'))
date_time=(data["analyses"][0]["date"]).split("'")[0]
date=date_time[0:10]
print date
I need to pass the output(date) to,
/sonar/api/issues/search?pageSize=1&projectUuids=AV7s-_ldd2-CFpJxZLc4&types=BUG&createdAt=date&resolved=false
Any suggestion?
Call api/issues/search with a date format that respect one of the 2 formats:
2017-10-19T13:00:00+0200
2017-10-19
I refer http://jmeter.apache.org/usermanual/generating-dashboard.html#configure_general, the resulting report errors number is not correct , the value is always more than the actual situation 1 (cvs , only five false, but the display 6 errors number), I do not know bug or I did not find the configuration of the place is not Jmeter3.0 ?
It is a reported minor issue in JMeter :
https://bz.apache.org/bugzilla/show_bug.cgi?id=59621
Error count in report dashboard is one off.
It is now fixed in jmeter nightly build:
http://jmeter.apache.org/nightly.html
I was not able to generate HTML report as you showed in your screenshot, evn though I have configured as per instructions. And also in the csv file I am anot able to see the Label.
Could you please guide me,where am i missing.
**My jmeterproperties file settings:**
# legitimate values: xml, csv, db. Only xml and csv are currently supported.
jmeter.save.saveservice.output_format=csv
# true when field should be saved; false otherwise
# assertion_results_failure_message only affects CSV output
jmeter.save.saveservice.assertion_results_failure_message=true
#
# legitimate values: none, first, all
#jmeter.save.saveservice.assertion_results=none
#
jmeter.save.saveservice.data_type=true
jmeter.save.saveservice.label=true
jmeter.save.saveservice.response_code=true
# response_data is not currently supported for CSV output
jmeter.save.saveservice.response_data=false
# Save ResponseData for failed samples
jmeter.save.saveservice.response_data.on_error=false
jmeter.save.saveservice.response_message=true
jmeter.save.saveservice.successful=true
jmeter.save.saveservice.thread_name=true
jmeter.save.saveservice.time=true
jmeter.save.saveservice.subresults=true
jmeter.save.saveservice.assertions=true
jmeter.save.saveservice.latency=true
jmeter.save.saveservice.connect_time=false
#jmeter.save.saveservice.samplerData=false
jmeter.save.saveservice.responseHeaders=false
jmeter.save.saveservice.requestHeaders=false
#jmeter.save.saveservice.encoding=false
jmeter.save.saveservice.bytes=true
jmeter.save.saveservice.url=false
#jmeter.save.saveservice.filename=false
#jmeter.save.saveservice.hostname=false
jmeter.save.saveservice.thread_counts=true
jmeter.save.saveservice.sample_count=false
#jmeter.save.saveservice.idle_time=true
# Timestamp format - this only affects CSV output files
# legitimate values: none, ms, or a format suitable for SimpleDateFormat
jmeter.save.saveservice.timestamp_format=ms
jmeter.save.saveservice.timestamp_format=yyyy/MM/dd HH:mm:ss.SSS
My UserProperties file settings:
Configure this property to change the report title
jmeter.reportgenerator.report_title=TimeTrax Performance Test JMeter Report Dashboard
# Change this parameter if you want to change the granularity of over time graphs.
jmeter.reportgenerator.overall_granularity=60000
# Change this parameter if you want to change the granularity of Response time distribution
# Set to 500 ms by default
jmeter.reportgenerator.graph.responseTimeDistribution.property.set_granularity=500
# Change this parameter if you want to keep only some samples.
# Regular Expression which Indicates which samples to keep for graphs and statistics generation.
# Empty value means no filtering
#jmeter.reportgenerator.sample_filter=
# Change this parameter if you want to override the APDEX satisfaction threshold.
#jmeter.reportgenerator.apdex_satisfied_threshold=500
jmeter.reportgenerator.apdex_satisfied_threshold=1500
# Change this parameter if you want to override the APDEX tolerance threshold.
#jmeter.reportgenerator.apdex_tolerated_threshold=1500
jmeter.reportgenerator.apdex_tolerated_threshold=3000
# Indicates which graph series are filtered (regular expression)
# In the below example we filter on Search and Order samples
# Note that the end of the pattern should always include (-success|-failure)?
# TransactionsPerSecondGraphConsumer suffixes transactions with "-success" or "-failure" depending
# on the result
#jmeter.reportgenerator.exporter.html.series_filter=(Search|Order)(-success|-failure)?
jmeter.reportgenerator.exporter.html.series_filter=(Search|Order)(-success|-failure)?
# Indicates whether only controller samples are displayed on graphs that support it.
#jmeter.reportgenerator.exporter.html.show_controllers_only=false
# Indicates whether series filter apply only on sample series or to all series
# setting this to false can lead to empty graphs if series_filter does not
# contain required series
jmeter.reportgenerator.exporter.html.filters_only_sample_series=true
Thanks,
Raj
I have given good explanation report dashboard generation in this StachExchange Question,please follow same steps to generate HTML reports for your test plan.
How do I generate a Dashboard Report in jmeter?