Skip to content

Commit

Permalink
Version 6.0 date 2024-09-19,use new library har-to-jmeter-convertor v…
Browse files Browse the repository at this point in the history
…6.0 that add 'HTTP(S) Test Script Recorder' and 'View Results Tree' to view the Record.xml file created. Correct save file no url encoded name.
  • Loading branch information
DABURON Vincent committed Sep 19, 2024
1 parent ca9e347 commit c2b93d3
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 38 deletions.
72 changes: 38 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,42 +142,43 @@ Help to see all parameters :
<pre>
C:\apache-jmeter\bin&gt;har-convertor-to-jmeter.cmd -help

usage: io.github.vdaburon.jmeter.har.HarForJMeter [-add_pause &lt;add_pause&gt;] [-external_file_infos &lt;external_file_infos&gt;]
[-filter_exclude &lt;filter_exclude&gt;] [-filter_include &lt;filter_include&gt;] -har_in &lt;har_in&gt; [-help] -jmx_out &lt;jmx_out&gt;
[-new_tc_pause &lt;new_tc_pause&gt;] [-page_start_number &lt;page_start_number&gt;] [-record_out &lt;record_out&gt;]
[-remove_cache_request &lt;remove_cache_request&gt;] [-remove_cookie &lt;remove_cookie&gt;] [-sampler_start_number
&lt;sampler_start_number&gt;] [-use_lrwr_infos &lt;use_lrwr_infos&gt;]
usage: io.github.vdaburon.jmeter.har.HarForJMeter [-add_pause &lt;add_pause&gt;] [-add_result_tree_record
&lt;add_result_tree_record&gt;] [-external_file_infos &lt;external_file_infos&gt;] [-filter_exclude &lt;filter_exclude&gt;]
[-filter_include &lt;filter_include&gt;] -har_in &lt;har_in&gt; [-help] -jmx_out &lt;jmx_out&gt; [-new_tc_pause &lt;new_tc_pause&gt;]
[-page_start_number &lt;page_start_number&gt;] [-record_out &lt;record_out&gt;] [-remove_cache_request
&lt;remove_cache_request&gt;] [-remove_cookie &lt;remove_cookie&gt;] [-sampler_start_number &lt;sampler_start_number&gt;]
[-use_lrwr_infos &lt;use_lrwr_infos&gt;]
io.github.vdaburon.jmeter.har.HarForJMeter
-add_pause &lt;add_pause&gt; Optional boolean, add Flow Control Action Pause after Transaction
Controller (default true)
-external_file_infos &lt;external_file_infos&gt; Optional, csv file contains external infos : timestamp transaction name
and start or end
-filter_exclude &lt;filter_exclude&gt; Optional, regular expression to exclude url
-filter_include &lt;filter_include&gt; Optional, regular expression to include url
-har_in &lt;har_in&gt; Har file to read (e.g : my_file.har)
-help Help and show parameters
-jmx_out &lt;jmx_out&gt; JMeter file created to write (e.g : script.jmx)
-new_tc_pause &lt;new_tc_pause&gt; Optional, create new Transaction Controller after request ms, same as
jmeter property : proxy.pause, need to be &gt; 0 if set. Usefully for Har
created by Firefox or Single Page Application (Angular, ReactJS, VuesJS
...)
-page_start_number &lt;page_start_number&gt; Optional, the start page number for partial recording (default 1)
-record_out &lt;record_out&gt; Optional, file xml contains exchanges likes recorded by JMeter
-remove_cache_request &lt;remove_cache_request&gt; Optional boolean, remove cache header in the http request (default true
because add a Cache Manager)
-remove_cookie &lt;remove_cookie&gt; Optional boolean, remove cookie in http header (default true because add
a Cookie Manager)
-sampler_start_number &lt;sampler_start_number&gt; Optional, the start sampler number for partial recording (default 1)
-use_lrwr_infos &lt;use_lrwr_infos&gt; Optional, the har file has been generated with LoadRunner Web Recorder
and contains Transaction Name, expected value : 'transaction_name' or
don't add this parameter
E.g : java -jar har-for-jmeter-&lt;version&gt;-jar-with-dependencies.jar -har_in myhar.har -jmx_out scriptout.jmx
-new_tc_pause 5000 -add_pause true -filter_include "https://mysite/.*" -filter_exclude "https://notmysite/*"
-page_start_number 50 -sampler_start_number 250
-add_pause &lt;add_pause&gt; Optional boolean, add Flow Control Action Pause after Transaction
Controller (default true)
-add_result_tree_record &lt;add_result_tree_record&gt; Optional boolean, add 'View Result Tree' to view the record.xml file
created (default true), record_out must be not empty
-external_file_infos &lt;external_file_infos&gt; Optional, csv file contains external infos : timestamp transaction
name and start or end
-filter_exclude &lt;filter_exclude&gt; Optional, regular expression to exclude url
-filter_include &lt;filter_include&gt; Optional, regular expression to include url
-har_in &lt;har_in&gt; Har file to read (e.g : my_file.har)
-help Help and show parameters
-jmx_out &lt;jmx_out&gt; JMeter file created to write (e.g : script.jmx)
-new_tc_pause &lt;new_tc_pause&gt; Optional, create new Transaction Controller after request ms, same
as jmeter property : proxy.pause, need to be &gt; 0 if set. Usefully
for Har created by Firefox or Single Page Application (Angular,
ReactJS, VuesJS ...)
-page_start_number &lt;page_start_number&gt; Optional, the start page number for partial recording (default 1)
-record_out &lt;record_out&gt; Optional, file xml contains exchanges likes recorded by JMeter
-remove_cache_request &lt;remove_cache_request&gt; Optional boolean, remove cache header in the http request (default
true because add a Cache Manager)
-remove_cookie &lt;remove_cookie&gt; Optional boolean, remove cookie in http header (default true because
add a Cookie Manager)
-sampler_start_number &lt;sampler_start_number&gt; Optional, the start sampler number for partial recording (default 1)
-use_lrwr_infos &lt;use_lrwr_infos&gt; Optional, the har file has been generated with LoadRunner Web
Recorder and contains Transaction Name, expected value :
'transaction_name' or don't add this parameter
E.g : java -jar har-for-jmeter-&lt;version&gt;-jar-with-dependencies.jar -har_in myhar.har -jmx_out scriptout.jmx -record_out
recording.xml -add_result_tree_record true -new_tc_pause 5000 -add_pause true -filter_include "https://mysite/.*"
-filter_exclude "https://notmysite/*" -page_start_number 50 -sampler_start_number 250
</pre>

The parameter use_lrwr_infos correspond to checkbox "har created with lrwr". If true set parameter <code>-use_lrwr_infos transaction_name</code> if false don't add this parameter.

<pre>
C:\apache-jmeter\bin>har-convertor-to-jmeter.cmd -har_in "myhar.har" -jmx_out "script_out.jmx" -filter_include "https://mysite.com/.*" -filter_exclude "https://notmysite.com/.*" -add_pause true -new_tc_pause 5000
</pre>
Expand All @@ -196,13 +197,16 @@ The maven groupId, artifactId and version, this plugin is in the **Maven Central
```xml
<groupId>io.github.vdaburon</groupId>
<artifactId>har-convertor-jmeter-plugin</artifactId>
<version>5.2</version>
<version>6.0</version>
```

## License
Licensed under the Apache License, Version 2.0

## Versions
Version 6.0 date 2024-09-19, Use new library har-to-jmeter-convertor 6.0 for adding 'HTTP(S) Test Script Recorder' and 'View Results Tree' to view the Record.xml file created. Correct save file no url encoded name.

Version 5.3 date 2024-09-13, Use new library har-to-jmeter-convertor 5.3 that correct PUT with no parameter, no content and mime-type == null

Version 5.2 date 2024-06-20, Use new library har-to-jmeter-convertor 5.2 that correct extract parameters for mime type "form-urlencoded" ended with charset likes "application/x-www-form-urlencoded; charset=xxx"

Expand Down
Binary file modified doc/images/har_convertor_tool_gui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/images/jmeter_script_record_created.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.github.vdaburon</groupId>
<artifactId>har-convertor-jmeter-plugin</artifactId>
<version>5.2</version>
<version>6.0</version>
<packaging>jar</packaging>

<name>Apache JMeter Plugin to convert a HAR file to a JMeter script and Record XML</name>
Expand Down Expand Up @@ -62,6 +62,7 @@
<mavenCentralAutoReleaseAfterClose>false</mavenCentralAutoReleaseAfterClose>
</properties>


<dependencies>
<dependency>
<groupId>org.apache.jmeter</groupId>
Expand All @@ -81,7 +82,7 @@
<dependency>
<groupId>io.github.vdaburon</groupId>
<artifactId>har-to-jmeter-convertor</artifactId>
<version>5.2</version>
<version>6.0</version>
</dependency>
</dependencies>

Expand Down Expand Up @@ -170,7 +171,7 @@
-->
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<version>1.7.0</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public class HarConvertorGui extends AbstractAction implements
private JCheckBox isRemoveCookieCheckbox;
private JCheckBox isRemoveCacheRequestHeaderCheckbox;
private JCheckBox isUseLrwrTransactionNameCheckbox;
private JCheckBox isAddResultTreeRecordCheckbox;

private JButton btConvert;
private JButton btConvertAndLoad;
Expand Down Expand Up @@ -234,8 +235,10 @@ public void actionPerformed(ActionEvent action) {

boolean isRemoveCookieHeader = isRemoveCookieCheckbox.isSelected();
boolean isRemoveCacheRequestHeader = isRemoveCacheRequestHeaderCheckbox.isSelected();
boolean isAddResultTreeRecord = isAddResultTreeRecordCheckbox.isSelected();
boolean isUseLrwrTransactionName = isUseLrwrTransactionNameCheckbox.isSelected();


String lrwr_info = "";
if (isUseLrwrTransactionName) {
lrwr_info = HarForJMeter.K_LRWR_USE_TRANSACTION_NAME;
Expand All @@ -249,6 +252,7 @@ public void actionPerformed(ActionEvent action) {
log.info("fileHarIn=<"+ fileHarIn + ">");
log.info("fileJmxOut=<" + fileJmxOut + ">");
log.info("recordXmlOut=<" + recordXmlOut + ">");
log.info("isAddResultTreeRecord=<" + isAddResultTreeRecord + ">");
log.info("createNewTransactionAfterRequestMs=<" + createNewTransactionAfterRequestMs + ">");
log.info("isAddPause=<" + isAddPause + ">");
log.info("regexFilterInclude=<" + regexFilterInclude + ">");
Expand All @@ -260,7 +264,7 @@ public void actionPerformed(ActionEvent action) {
log.info("externalFileInfoIn=<" + externalFileInfoIn + ">");
log.info("****************************************");

HarForJMeter.generateJmxAndRecord(fileHarIn, fileJmxOut,createNewTransactionAfterRequestMs,isAddPause, isRemoveCookieHeader, isRemoveCacheRequestHeader, regexFilterInclude, regexFilterExclude, recordXmlOut, pageStartNumber, samplerStartNumber, lrwr_info, externalFileInfoIn);
HarForJMeter.generateJmxAndRecord(fileHarIn, fileJmxOut,createNewTransactionAfterRequestMs,isAddPause, isRemoveCookieHeader, isRemoveCacheRequestHeader, regexFilterInclude, regexFilterExclude, recordXmlOut, pageStartNumber, samplerStartNumber, lrwr_info, externalFileInfoIn, isAddResultTreeRecord);

log.info("After HarForJMeter.generateJmxAndRecord");
btConvert.setEnabled(true);
Expand Down Expand Up @@ -383,6 +387,9 @@ private JPanel createCheckbox() {
JLabel isRemoveCacheHeaderLabel = new JLabel("(Optional) Remove cache header in the http request (default true because add a Cache Manager)");
isRemoveCacheRequestHeaderCheckbox= new JCheckBox("",true);

JLabel isAddResultTreeRecordLabel = new JLabel("(Optional) Add 'View Result Tree' to view the recording xml file created (default true)");
isAddResultTreeRecordCheckbox= new JCheckBox("",true);

JLabel isUseLrwrTransactionNameLabel = new JLabel("(Optional) HAR was generated with LoadRunner Web Recorder and Transaction Names (default false)");
isUseLrwrTransactionNameCheckbox= new JCheckBox("",false);

Expand All @@ -395,6 +402,9 @@ private JPanel createCheckbox() {
panel.add(isRemoveCacheHeaderLabel);
panel.add(isRemoveCacheRequestHeaderCheckbox);

panel.add(isAddResultTreeRecordLabel);
panel.add(isAddResultTreeRecordCheckbox);

panel.add(isUseLrwrTransactionNameLabel);
panel.add(isUseLrwrTransactionNameCheckbox);

Expand Down

0 comments on commit c2b93d3

Please sign in to comment.