Getting error while running merged jtl files - jmeter

I am trying to generate the report in JMeter by merging .jtl files content getting below error -
File '/home/ajij/jmeter_tests_cli/merged.jtl' does not contain the field names header, ensure the jmeter.save.saveservice.* properties are the same as when the CSV file was created or the file may be read incorrectly when generating report
An error occurred: Error while processing samples: Consumer failed with message :Could not parse timeStamp <timeStamp> using format defined by property jmeter.save.saveservice.timestamp_format=ms on sample timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,URL,Latency,IdleTime,Connect
Note -
If i run 2 independent jtl files then will get run successfully
Command to execute JTL file -
../Documents/apache-jmeter-5.2/bin/jmeter.sh -g merged.jtl -o ./folder
JTL File content -
https://drive.google.com/file/d/1j6kZ7mUj0IbT6hWS0KR3BsZVK4t6wQzj/view?usp=sharing
Quick Help will be appreciated !!!

As per JMeter's documentation:
The dashboard generator is a modular extension of JMeter. Its default behavior is to read and process samples from CSV files to generate HTML files containing graph views. It can generate the report at end of a load test or on demand.
As of current latest stable version JMeter 5.3 generating dashboards from .jtl files in XML format is not supported so either re-run your test with the following JMeter property defined:
jmeter.save.saveservice.output_format=csv
or review your way of "merging" the result files, if it supports CSV output format - go for it.

Did you try removing the XML tags? I haven't tested yet using the CSV you shared, but it might be enough removing the XML tags and merging "manually" the files, I'd merge the files by removing the second headers and the XML tags, remember JMeter process the requests by time so it will order the requests by timestamp

Related

JMeterLibException: 'Incorrect log file format'

JMeter 2.12
python 2.7.18
I'm getting JMeterLibException: 'Incorrect log file format' for the below code using robot framework
${logPath}= set variable C:/Tests/output1.log
run jmeter C:/Tests/apache-jmeter-5.4.1/bin/jmeter.bat C:/Tests/100users.jmx ${logPath}
${result} analyse jtl convert ${logPath}
log ${result}
FOR ${ELEMENT} IN #{result}
log dictionary ${ELEMENT}
It seems that your "JMeterLib" (whatever it is) expects some specific JMeter .jtl file format and JMeter 5.4.1 default settings are not compatible with it.
Unfortunately we cannot really help you without seeing this "JMeterLib" output or source code so I can only provide a generic piece of advice:
JMeter .jtl file output is controllable via special set of properties responsible for Results file configuration, once you determine what exact metrics does your "JMeterLib" expect you can amend JMeter's configuration accordingly in order to make it compatible with your 3rd-party software assumptions.
More information:
Configuring JMeter
Apache JMeter Properties Customization Guide
You should use jtl file extension instead of log
${logPath}=set variableD:/Tests/output1.jtl

JMeter WebDriver Subsample labels not appearing in results

When using the WebDriver plugin for JMeter and using subsamples the labels that are set during the test do not appear in the results jtl file (and therefore the results tree/aggregate report etc.
WebDriver code (name = TestSampler):
WDS.sampleResult.subSampleStart('First SubSample')
...
WDS.sampleResult.subSampleEnd(true)
WDS.sampleResult.subSampleStart('Second SubSample')
...
WDS.sampleResult.subSampleEnd(true)
Desired outcome:
result.jtl file:
...
1603546255925,1000,First SubSample,,,ThreadGroup 1-1,text,true,,0,0,1,1,null,0,0,0
1603546257658,1000,Second SubSample,,,ThreadGroup 1-1,text,true,,0,0,1,1,null,0,0,0
Actual outcome:
result.jtl file:
...
1603546255925,1000,TestSampler-0,,,ThreadGroup 1-1,text,true,,0,0,1,1,null,0,0,0
1603546257658,1000,TestSampler-1,,,ThreadGroup 1-1,text,true,,0,0,1,1,null,0,0,0
note that the only difference is that the value passed to the ...subSampleStart(label) function appears in the result file instead of an indexed version of the sampler name.
Add the next line to user.properties file:
subresults.disable_renaming=true
Restart JMeter to pick the property up
Next time you will run your test you will see expected names
For GUI mode you can tick Functional Test Mode box on Test Plan level:
More information:
JMeter Bug 62550 - Modify SubResult Naming Policy
Apache JMeter Properties Customization Guide
Configuring JMeter

Neo.ClientError.Statement.ExternalResourceFailed on Mac

I have a CSV file I generate through code. I want to import the generated CSV file into neo4j using the following cypher query.
LOAD CSV WITH HEADERS FROM 'file:////Users/{user}/Desktop/neo4j-importer/tmp/temp_data.csv'
I have changed the following config varables
Commenting out dbms.directories.import=import.
And set dbms.security.allow_csv_import_from_file_urls=true
Problem is I get thrown the following error:
Neo.ClientError.Statement.ExternalResourceFailed:
Couldn't load the external resource at:
file:/Users/{user}/Library/Application%20Support/Neo4j%20Desktop/Application/neo4jDatabases/database-c517b267-220d-4b7a-be26-813d5b64a51a/installation-3.5.3/import/Users/{user}/Desktop/neo4j-importer/tmp/temp_data.csv
I mean it is partly right just not the /Users/{user}/Library/Application%20Support/Neo4j%20Desktop/Application/neo4jDatabases/database-c517b267-220d-4b7a-be26-813d5b64a51a/installation-3.5.3/import/ bit... Any suggestions on how to fix this weird file pathing problem?
Try changing the config setting to point to the directory with your imports:
dbms.directories.import=/Users/{user}/Desktop/neo4j-importer/tmp
and then changing the Cypher query to just specify the CSV file:
LOAD CSV WITH HEADERS FROM 'file:///temp_data.csv'
...

Generate Swagger json at Build time

I'm working on a ASP.NET Core WebAPI project and I'm trying to find a way to generate swagger json at build time ?
As i'm working with 4 environments, i'd like to have 4 swagger.json with a different name of my choice, like:
swagger_{appName}dev{buildNumber}.json
swagger_{appName}demo{buildNumber}.json
swagger_{appName}int{buildNumber}.json
swagger_{appName}staging{buildNumber}.json
Is it also possible to edit the fields in the json ? I'd like to edit (depending of the environment) the following fields : host, schemes and basePath.
I'm using Swashbuckle.AspNetCore but it appears it doesn't have an option to do such task or am I wrong ?
Thanks in advance
You have the option of generating OpenApi json file(s) from the command line without deploying using the Swashbuckle.AspNetCore.Cli nuget package.
The command will look something like this and can be added as a "post build" script
dotnet <nugetpackages>\Swashbuckle.AspNetCore.Cli\bin\$(Configuration)\netcoreapp<ver>\dotnet-swagger.dll tofile --host http://localhost --output swagger.json <bin>\<AssemblyName>.dll v1
more details can be found here https://github.com/domaindrivendev/Swashbuckle.AspNetCore#swashbuckleaspnetcorecli
I'm not sure about generating separate files for each environment offhand
The simple way is using PowerShell task to update json file and save with another name.
Simple workflow:
Read the file through Get-Content script
Using ConvertFrom-Json to converts content to object
Set the property value to update object
Using ConvertTo-Json to convert an object to a JSON-formatted string
Using Set-Content to write content to a file
For detail code, you can refer to this thread: how do I update json file using powershell.
The build number value is stored in the predefined variable: Build.BuildNumber (PowerShell: $env:BUILD_BUILDNUMBER)

How to Print Console.Log to JUnitXmlReporter using protractor?

I am doing a protractor test. I want to print the messages i wrote inside the test using Console.Log("Message") to JUnitXmlReporter(the XML file). OR .... is ther anyway to create a custom Output files using protractor. I want to print a Data i fetched from the test to a File.
Have you tried:
https://github.com/larrymyers/jasmine-reporters
from their page:
JUnitXmlReporter - Report test results to a file in JUnit XML Report format.
NUnitXmlReporter - Report test results to a file in NUnit XML Report format.
you can also create a custom one:
http://jasmine.github.io/2.1/custom_reporter.html
hope it helps
You can keep things simple. You dont need any custom reporters to write the console information to a file. Just use the terminal output redirecting operator.
protractor conf.js > consoleLog.log
To append
protractor conf.js >> consoleLog.log
Check here for more options

Resources