diff --git a/README.md b/README.md
index b0ca01a..2a2763b 100644
--- a/README.md
+++ b/README.md
@@ -24,16 +24,20 @@ Parameters are :
e.g. record_out = record.xml
* new_tc_pause time between 2 urls to create a new page (Transaction Controller) (default 5000 = jmeter property value : proxy.pause=5000)
* e.g. 5000 for 5 sec between 2 urls
+* page_start_number, set the start page number for partial recording (default 1, must be an integer > 0)
+* sampler_start_number, set the start sampler number for partial recording (default 1, must be an integer > 0)
* filter_include, the regular expression matches the URL to Include
* default all = empty (no filter)
- * e.g. filter_include = https://mysite.com/.*
+ * e.g. filter_include=https://mysite.com/.*
* filter_exclude, the regular expression matches the URL to Exclude
* default all = empty (no filter)
- * e.g. filter_include = https://notmysite.com/.*
+ * e.g. filter_exclude=https://notmysite.com/.*
+ * or filter statics, filter_exclude=(?i).*\.(bmp|css|js|gif|ico|jpe?g|png|swf|eot|otf|ttf|mp4|woff|woff2)
* add_pause checkbox, add Flow Control Action Pause, parameter new_tc_pause must be > 0 (default true)
* remove_cookie checkbox , remove header with cookie because add a Cookie Manager in the script (default true)
* remove_cache_request checkbox, remove cache request header because add a Cache Manager in the script (default true)
+
Status, the status line contains the tool status or the tool result.
e.g. : Status Results **OK**
@@ -82,7 +86,8 @@ Help to see all parameters :
C:\apache-jmeter\bin>har-convertor-to-jmeter.cmd -help
usage: io.github.vdaburon.jmeter.har.HarForJMeter [-add_pause <add_pause>] [-filter_exclude <filter_exclude>]
[-filter_include <filter_include>] -har_in <har_in> [-help] -jmx_out <jmx_out> [-new_tc_pause <new_tc_pause>]
- [-record_out <record_out>] [-remove_cache_request <remove_cache_request>] [-remove_cookie <remove_cookie>]
+ [-page_start_number <page_start_number>] [-record_out <record_out>] [-remove_cache_request
+ <remove_cache_request>] [-remove_cookie <remove_cookie>] [-sampler_start_number <sampler_start_number>]
io.github.vdaburon.jmeter.har.HarForJMeter
-add_pause <add_pause> Optional boolean, add Flow Control Action Pause after Transaction
Controller (default true)
@@ -95,13 +100,16 @@ io.github.vdaburon.jmeter.har.HarForJMeter
jmeter property : proxy.pause, need to be > 0 if set. Usefully for Har
created by Firefox or Single Page Application (Angular, ReactJS, VuesJS
...)
+ -page_start_number <page_start_number> Optional, the start page number for partial recording (default 1)
-record_out <record_out> Optional, file xml contains exchanges likes recorded by JMeter
-remove_cache_request <remove_cache_request> Optional boolean, remove cache header in the http request (default true
because add a Cache Manager)
-remove_cookie <remove_cookie> Optional boolean, remove cookie in http header (default true because add
a Cookie Manager)
+ -sampler_start_number <sampler_start_number> Optional, the start sampler number for partial recording (default 1)
E.g : java -jar har-for-jmeter-<version>-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
@@ -123,8 +131,10 @@ The maven groupId, artifactId and version, this plugin is in the **Maven Central
```xml
io.github.vdaburon
har-convertor-jmeter-plugin
-1.0
+2.0
```
## Versions
-Version 1.0 date 2024-0311, First Release
+Version 2.0 date 2024-03-12, for POST multipart/form-data don't put the content of the file in the Record.xml file because binary content could be large and not XML compatible. Add parameters : page_start_number and sampler_start_number to facilitate partial recording of website navigation.
+
+Version 1.0 date 2024-03-11, First Release.
diff --git a/doc/images/har_convertor_tool_gui.png b/doc/images/har_convertor_tool_gui.png
index a08410d..13718fd 100644
Binary files a/doc/images/har_convertor_tool_gui.png and b/doc/images/har_convertor_tool_gui.png differ
diff --git a/pom.xml b/pom.xml
index 6eeaf1d..6a2fa96 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
io.github.vdaburon
har-convertor-jmeter-plugin
- 1.0
+ 2.0
jar
Apache JMeter Plugin to convert a HAR file to a JMeter script and Record XML
@@ -74,7 +74,7 @@
io.github.vdaburon
har-to-jmeter-convertor
- 1.0
+ 2.0
diff --git a/src/main/java/io/github/vdaburon/jmeterplugins/har/gui/HarConvertorGui.java b/src/main/java/io/github/vdaburon/jmeterplugins/har/gui/HarConvertorGui.java
index 4d5d7f9..40264a1 100644
--- a/src/main/java/io/github/vdaburon/jmeterplugins/har/gui/HarConvertorGui.java
+++ b/src/main/java/io/github/vdaburon/jmeterplugins/har/gui/HarConvertorGui.java
@@ -58,6 +58,8 @@ public class HarConvertorGui extends AbstractAction implements
private JTextField fileJmxOutTextField;
private JTextField fileRecordOutTextField;
private JTextField pauseBetweenUrlTextField;
+ private JTextField pageStartNumberTextField;
+ private JTextField samplerStartNumberTextField;
private JButton fileHarInFileButton;
private JTextField regexFilterIncludeField;
private JTextField regexFilterExcludeField;
@@ -183,6 +185,34 @@ public void actionPerformed(ActionEvent action) {
}
}
+ String sPageStartNumber = pageStartNumberTextField.getText();
+ int pageStartNumber = 1;
+ if (!sPageStartNumber.isEmpty()) {
+ try {
+ pageStartNumber = Integer.parseInt(sPageStartNumber);
+ } catch (Exception ex) {
+ log.warn("Error parsing int parameter " + ", value = " + sPageStartNumber + ", set to 1");
+ pageStartNumber = 1;
+ }
+ }
+ if (pageStartNumber <= 0) {
+ pageStartNumber = 1;
+ }
+
+ String sSamplerStartNumber = samplerStartNumberTextField.getText();
+ int samplerStartNumber = 1;
+ if (!sSamplerStartNumber.isEmpty()) {
+ try {
+ samplerStartNumber = Integer.parseInt(sSamplerStartNumber);
+ } catch (Exception ex) {
+ log.warn("Error parsing int parameter " + ", value = " + sSamplerStartNumber + ", set to 1");
+ samplerStartNumber = 1;
+ }
+ }
+ if (samplerStartNumber <= 0) {
+ samplerStartNumber = 1;
+ }
+
boolean isRemoveCookieHeader = isRemoveCookieCheckbox.isSelected();
boolean isRemoveCacheRequestHeader = isRemoveCacheRequestHeaderCheckbox.isSelected();
@@ -199,10 +229,11 @@ public void actionPerformed(ActionEvent action) {
log.info("regexFilterInclude=<" + regexFilterInclude + ">");
log.info("regexFilterExclude=<" + regexFilterExclude + ">");
log.info("isRemoveCookieHeader=<" + isRemoveCookieHeader + ">");
- log.info("isRemoveCacheRequestHeader=<" + isRemoveCacheRequestHeader + ">");
+ log.info("samplerStartNumber=<" + samplerStartNumber + ">");
+ log.info("samplerStartNumber=<" + samplerStartNumber + ">");
log.info("****************************************");
- HarForJMeter.generateJmxAndRecord(fileHarIn, fileJmxOut,createNewTransactionAfterRequestMs,isAddPause, isRemoveCookieHeader, isRemoveCacheRequestHeader, regexFilterInclude, regexFilterExclude, recordXmlOut);
+ HarForJMeter.generateJmxAndRecord(fileHarIn, fileJmxOut,createNewTransactionAfterRequestMs,isAddPause, isRemoveCookieHeader, isRemoveCacheRequestHeader, regexFilterInclude, regexFilterExclude, recordXmlOut, pageStartNumber, samplerStartNumber);
log.info("After HarForJMeter.generateJmxAndRecord");
btConvert.setEnabled(true);
@@ -269,9 +300,21 @@ private JPanel createFilterAndPausePanel() {
JLabel pauseBetweenUrlLabel = new JLabel("(Optional) Time (ms) between 2 URLs to create a new page (Transaction Controller)");
pauseBetweenUrlTextField = new JTextField("5000", 80);
+ JLabel pageStartNumberLabel = new JLabel("(Optional) Page start number usually for partial recording (default 1)");
+ pageStartNumberTextField = new JTextField("", 80);
+
+ JLabel samplerStartNumberLabel = new JLabel("(Optional) Sampler start number usually for partial recording (default 1)");
+ samplerStartNumberTextField = new JTextField("", 80);
+
panel.add(pauseBetweenUrlLabel);
panel.add(pauseBetweenUrlTextField);
+ panel.add(pageStartNumberLabel);
+ panel.add(pageStartNumberTextField);
+
+ panel.add(samplerStartNumberLabel);
+ panel.add(samplerStartNumberTextField);
+
panel.add(regexFilterIncludeLabel);
panel.add(regexFilterIncludeField);