Create a csv file with transaction information to complete a HAR (Http ARchive) file.
Link to github project create-external-file-for-har
Console text tool to create transaction info corresponding to a har file.
Create a csv file with transaction information to complete a HAR (Http ARchive) file.
The csv format is : TIME_STAMP ISO GMT;ELEMENT;NAME;TYPE
- Timestamp ISO GMT format
- ELEMENT values are :
TRANSACTION
orCOMMENT
- TYPE for transaction, values are :
start
orstop
- CSV separtor : ";"
- Charset : "UTF-8"
E.g :
2024-05-07T07:56:40.513Z;TRANSACTION;authent;start 2024-05-07T07:56:56.261Z;TRANSACTION;authent;stop 2024-05-07T07:57:08.679Z;TRANSACTION;home;start 2024-05-07T07:57:10.123Z;COMMENT;user toto; 2024-05-07T07:57:14.310Z;TRANSACTION;home;stop 2024-05-07T07:57:30.280Z;TRANSACTION;logout;start 2024-05-07T07:58:15.377Z;TRANSACTION;logout;stop
This tool could be use with script shell Windows or Linux.
C:\mydir>java -jar -Dfile.encoding=UTF-8 -jar ../target/create-external-file-for-har-1.0-jar-with-dependencies.jar
With set file out parameter :
C:\mydir>java -jar -Dfile.encoding=UTF-8 -jar ../target/create-external-file-for-har-1.0-jar-with-dependencies.jar c:/temp/demo1.csv
Command help or h display :
Help Commands : sf <file name> : Set the File out name to save information, need to be first command or the file name is set at program start with a launch program parameter ch <charset> : set the CHarset to write in the file out (e.g : UTF-8 (Default) or ISO-8859-1 or Cp1252 (windows)) ts <transaction name> : for Transaction Start with transaction name not empty te [<transaction name>] : for Transaction End if no transaction name then use the last transaction name de <transaction name> : DElete start and end transaction in csv file or a comment co <comment> : add a COmment sh : SHow content file exit : save file and EXIT help : this HELP h : this Help short command
Record a HAR file and create external csv file with create-external-file-to-har tool.
For Chrome Browser (B for Browser) :
B1) Open navigator (Chrome)
B2) Open dev tools with <F12>
B3) Tab "Network"
B4) Record button is ON.
B5) "Preserve log" is checked. (Optional) If needed, delete the exchanges before browsing
Start create-external-file-for-har tool (C for Create external file tool)
C1) Set a file name , command : sf c:/Temp/jpetstore_transaction.csv
C2) Create the first transaction start, command : ts welcome
B6) Navigate to the home url in the Browser
C3) When the page is display, end the first transaction (welcome), command : te
C4) Create a new transaction for future page, command : ts enter store
B7) Click on link or click on button to navigate to store page
C5) When the page is display, end the current transaction (store page), command : te
C4) Create a new transaction for future page, command : ts page3
B8) Click on link or click on button to navigate to the page3
C5) When the page is display, end the current transaction (page3), command : te
C6) Create a new transaction for futur page ou form, command : ts <page name>
B9) Navigate to the page
C7) When the page is display, end the current transaction (page name), command : te
... continue to create a transaction before navigate, navigate to the page, end the transaction ...
Bx) When navigation is finished, Save exchanges in HAR format "Export HAR ..."
The csv file created will be used by this other tool : "har-to-jmeter-convertor" https://github.com/vdaburon/har-to-jmeter-convertor
or this JMeter plugin "har-convertor-jmeter-plugin" https://github.com/vdaburon/har-convertor-jmeter-plugin
This example use the JPetstore from Octoperf : https://petstore.octoperf.com/
Licensed under the Apache License, Version 2.0
Version 1.0 date 2024-05-10, First version