How to upload file in a JSF application using JMeter
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I've been asked this time to also create a test script for file upload in a JSF application using JMeter. The generated script from blazemeter is as follows:
generated script for input form
The encircled value is the file name. I have noticed that the parameter was not created under "Files Upload" tab, so I have also tried to move the parameter to File Upload tab, using the generated content type in our application logs when uploading as Mime Type in JMeter:
Jmeter file upload tab
Generated content type
But it has the same result when I first tried the script where the file name parameter was still under "Parameters" tab (file name is null according to localhost application logs):
Application log indicating that file name is null
The UI of the file upload is this. The user clicks browse button, picks a file then the name of the file is displayed in the input field (Import File). The user would then click the Import button to submit the form:
File upload UI
Am I missing a step or doing something incorrectly?
Thank you in advance! Any help would be greatly appreciated.
java jsf testing upload jmeter
add a comment |
I've been asked this time to also create a test script for file upload in a JSF application using JMeter. The generated script from blazemeter is as follows:
generated script for input form
The encircled value is the file name. I have noticed that the parameter was not created under "Files Upload" tab, so I have also tried to move the parameter to File Upload tab, using the generated content type in our application logs when uploading as Mime Type in JMeter:
Jmeter file upload tab
Generated content type
But it has the same result when I first tried the script where the file name parameter was still under "Parameters" tab (file name is null according to localhost application logs):
Application log indicating that file name is null
The UI of the file upload is this. The user clicks browse button, picks a file then the name of the file is displayed in the input field (Import File). The user would then click the Import button to submit the form:
File upload UI
Am I missing a step or doing something incorrectly?
Thank you in advance! Any help would be greatly appreciated.
java jsf testing upload jmeter
add a comment |
I've been asked this time to also create a test script for file upload in a JSF application using JMeter. The generated script from blazemeter is as follows:
generated script for input form
The encircled value is the file name. I have noticed that the parameter was not created under "Files Upload" tab, so I have also tried to move the parameter to File Upload tab, using the generated content type in our application logs when uploading as Mime Type in JMeter:
Jmeter file upload tab
Generated content type
But it has the same result when I first tried the script where the file name parameter was still under "Parameters" tab (file name is null according to localhost application logs):
Application log indicating that file name is null
The UI of the file upload is this. The user clicks browse button, picks a file then the name of the file is displayed in the input field (Import File). The user would then click the Import button to submit the form:
File upload UI
Am I missing a step or doing something incorrectly?
Thank you in advance! Any help would be greatly appreciated.
java jsf testing upload jmeter
I've been asked this time to also create a test script for file upload in a JSF application using JMeter. The generated script from blazemeter is as follows:
generated script for input form
The encircled value is the file name. I have noticed that the parameter was not created under "Files Upload" tab, so I have also tried to move the parameter to File Upload tab, using the generated content type in our application logs when uploading as Mime Type in JMeter:
Jmeter file upload tab
Generated content type
But it has the same result when I first tried the script where the file name parameter was still under "Parameters" tab (file name is null according to localhost application logs):
Application log indicating that file name is null
The UI of the file upload is this. The user clicks browse button, picks a file then the name of the file is displayed in the input field (Import File). The user would then click the Import button to submit the form:
File upload UI
Am I missing a step or doing something incorrectly?
Thank you in advance! Any help would be greatly appreciated.
java jsf testing upload jmeter
java jsf testing upload jmeter
edited Nov 14 '18 at 5:51
Noreen Lazo
asked Nov 14 '18 at 5:44
Noreen LazoNoreen Lazo
104
104
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Your way of building a file upload request might be wrong, if you want to continue manual experiments I would recommend comparing requests which are being sent by JMeter and the real browser using a sniffer tool like Wireshark. Apart from $VIEWSTATE
the requests should be exactly the same.
An easier option would be just re-recording the request (you can record only one single request) using HTTP(S) Test Script Recorder.
Prepare JMeter for recording. The easiest way of doing this is using JMeter Templates feature
from JMeter main menu choose
File -> Templates -> Recording
and click "Create"expand HTTP(S) Test Script Recorder and click "Start"
Prepare your browser for recording, refer your browser documentation in order to set up proxy using
localhost
as the proxy host and8888
as the proxy port, the proxy needs to be set for all protocols with no exclusions. The relevant configuration for Mozilla Firefox (the only free and open source popular browser, moreover it has separate proxy configuration which does not derive from the operating system) would be:
Copy the file you will be recording to the "bin" folder of your JMeter installation. If you omit this step JMeter will not be able to properly record the request. See Recording File Uploads with JMeter article for more details if needed- Execute the request in browser - the relevant HTTP Request sampler will be generated under the Recording Controller
Thank you Dmitri, I tried recording using HTTPS(S) Test script recorder, and after a few edits it worked properly in localhost. I also copied the difference to the generated script by blazemeter to make them identical. however when I run the blazemeter upload script, it was still unsuccessful dropbox link for the recorded scripts I would be creating the test script for the application server where I need to use the company proxy to connect to, so I was using blazemeter chrome extension for recording.
– Noreen Lazo
Nov 15 '18 at 3:20
Would there be any possible way to record script while using a company proxy? Or is there something I have missed when editing the blazemeter script to work properly like the generated script from HTTP(S) Test Script Recorder?
– Noreen Lazo
Nov 15 '18 at 3:21
The http request used for the file upload are the following: in blazemeter generated script: 6th http request; in jmeter Test Script Recorder: 7th http request
– Noreen Lazo
Nov 15 '18 at 3:27
Look into HTTP Header Manager for both scripts, there might be differences in i.e. Referer or Origin headers. With regards to recording test using JMeter via corporate proxy - it should not be a problem as well
– Dmitri T
Nov 15 '18 at 5:36
Upon checking, the jmeter generated script doesn't use a HTTP Header Manager, so I also removed the header manager in blazemeter script. I checked the request headers generated when running both scripts, and I noticed that there are discrepancies in Content-type request header. [Picture of request headers for both scripts. ](i.imgur.com/yyRZYxP.jpg) On the left side (jmeter) the highlighted strings are the same, but on the right side (blazemeter), they are different. Is it possible that the Content-type header is causing the problem...? If so, would there be a way on how to solve it?
– Noreen Lazo
Nov 15 '18 at 8:05
|
show 2 more comments
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53293852%2fhow-to-upload-file-in-a-jsf-application-using-jmeter%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your way of building a file upload request might be wrong, if you want to continue manual experiments I would recommend comparing requests which are being sent by JMeter and the real browser using a sniffer tool like Wireshark. Apart from $VIEWSTATE
the requests should be exactly the same.
An easier option would be just re-recording the request (you can record only one single request) using HTTP(S) Test Script Recorder.
Prepare JMeter for recording. The easiest way of doing this is using JMeter Templates feature
from JMeter main menu choose
File -> Templates -> Recording
and click "Create"expand HTTP(S) Test Script Recorder and click "Start"
Prepare your browser for recording, refer your browser documentation in order to set up proxy using
localhost
as the proxy host and8888
as the proxy port, the proxy needs to be set for all protocols with no exclusions. The relevant configuration for Mozilla Firefox (the only free and open source popular browser, moreover it has separate proxy configuration which does not derive from the operating system) would be:
Copy the file you will be recording to the "bin" folder of your JMeter installation. If you omit this step JMeter will not be able to properly record the request. See Recording File Uploads with JMeter article for more details if needed- Execute the request in browser - the relevant HTTP Request sampler will be generated under the Recording Controller
Thank you Dmitri, I tried recording using HTTPS(S) Test script recorder, and after a few edits it worked properly in localhost. I also copied the difference to the generated script by blazemeter to make them identical. however when I run the blazemeter upload script, it was still unsuccessful dropbox link for the recorded scripts I would be creating the test script for the application server where I need to use the company proxy to connect to, so I was using blazemeter chrome extension for recording.
– Noreen Lazo
Nov 15 '18 at 3:20
Would there be any possible way to record script while using a company proxy? Or is there something I have missed when editing the blazemeter script to work properly like the generated script from HTTP(S) Test Script Recorder?
– Noreen Lazo
Nov 15 '18 at 3:21
The http request used for the file upload are the following: in blazemeter generated script: 6th http request; in jmeter Test Script Recorder: 7th http request
– Noreen Lazo
Nov 15 '18 at 3:27
Look into HTTP Header Manager for both scripts, there might be differences in i.e. Referer or Origin headers. With regards to recording test using JMeter via corporate proxy - it should not be a problem as well
– Dmitri T
Nov 15 '18 at 5:36
Upon checking, the jmeter generated script doesn't use a HTTP Header Manager, so I also removed the header manager in blazemeter script. I checked the request headers generated when running both scripts, and I noticed that there are discrepancies in Content-type request header. [Picture of request headers for both scripts. ](i.imgur.com/yyRZYxP.jpg) On the left side (jmeter) the highlighted strings are the same, but on the right side (blazemeter), they are different. Is it possible that the Content-type header is causing the problem...? If so, would there be a way on how to solve it?
– Noreen Lazo
Nov 15 '18 at 8:05
|
show 2 more comments
Your way of building a file upload request might be wrong, if you want to continue manual experiments I would recommend comparing requests which are being sent by JMeter and the real browser using a sniffer tool like Wireshark. Apart from $VIEWSTATE
the requests should be exactly the same.
An easier option would be just re-recording the request (you can record only one single request) using HTTP(S) Test Script Recorder.
Prepare JMeter for recording. The easiest way of doing this is using JMeter Templates feature
from JMeter main menu choose
File -> Templates -> Recording
and click "Create"expand HTTP(S) Test Script Recorder and click "Start"
Prepare your browser for recording, refer your browser documentation in order to set up proxy using
localhost
as the proxy host and8888
as the proxy port, the proxy needs to be set for all protocols with no exclusions. The relevant configuration for Mozilla Firefox (the only free and open source popular browser, moreover it has separate proxy configuration which does not derive from the operating system) would be:
Copy the file you will be recording to the "bin" folder of your JMeter installation. If you omit this step JMeter will not be able to properly record the request. See Recording File Uploads with JMeter article for more details if needed- Execute the request in browser - the relevant HTTP Request sampler will be generated under the Recording Controller
Thank you Dmitri, I tried recording using HTTPS(S) Test script recorder, and after a few edits it worked properly in localhost. I also copied the difference to the generated script by blazemeter to make them identical. however when I run the blazemeter upload script, it was still unsuccessful dropbox link for the recorded scripts I would be creating the test script for the application server where I need to use the company proxy to connect to, so I was using blazemeter chrome extension for recording.
– Noreen Lazo
Nov 15 '18 at 3:20
Would there be any possible way to record script while using a company proxy? Or is there something I have missed when editing the blazemeter script to work properly like the generated script from HTTP(S) Test Script Recorder?
– Noreen Lazo
Nov 15 '18 at 3:21
The http request used for the file upload are the following: in blazemeter generated script: 6th http request; in jmeter Test Script Recorder: 7th http request
– Noreen Lazo
Nov 15 '18 at 3:27
Look into HTTP Header Manager for both scripts, there might be differences in i.e. Referer or Origin headers. With regards to recording test using JMeter via corporate proxy - it should not be a problem as well
– Dmitri T
Nov 15 '18 at 5:36
Upon checking, the jmeter generated script doesn't use a HTTP Header Manager, so I also removed the header manager in blazemeter script. I checked the request headers generated when running both scripts, and I noticed that there are discrepancies in Content-type request header. [Picture of request headers for both scripts. ](i.imgur.com/yyRZYxP.jpg) On the left side (jmeter) the highlighted strings are the same, but on the right side (blazemeter), they are different. Is it possible that the Content-type header is causing the problem...? If so, would there be a way on how to solve it?
– Noreen Lazo
Nov 15 '18 at 8:05
|
show 2 more comments
Your way of building a file upload request might be wrong, if you want to continue manual experiments I would recommend comparing requests which are being sent by JMeter and the real browser using a sniffer tool like Wireshark. Apart from $VIEWSTATE
the requests should be exactly the same.
An easier option would be just re-recording the request (you can record only one single request) using HTTP(S) Test Script Recorder.
Prepare JMeter for recording. The easiest way of doing this is using JMeter Templates feature
from JMeter main menu choose
File -> Templates -> Recording
and click "Create"expand HTTP(S) Test Script Recorder and click "Start"
Prepare your browser for recording, refer your browser documentation in order to set up proxy using
localhost
as the proxy host and8888
as the proxy port, the proxy needs to be set for all protocols with no exclusions. The relevant configuration for Mozilla Firefox (the only free and open source popular browser, moreover it has separate proxy configuration which does not derive from the operating system) would be:
Copy the file you will be recording to the "bin" folder of your JMeter installation. If you omit this step JMeter will not be able to properly record the request. See Recording File Uploads with JMeter article for more details if needed- Execute the request in browser - the relevant HTTP Request sampler will be generated under the Recording Controller
Your way of building a file upload request might be wrong, if you want to continue manual experiments I would recommend comparing requests which are being sent by JMeter and the real browser using a sniffer tool like Wireshark. Apart from $VIEWSTATE
the requests should be exactly the same.
An easier option would be just re-recording the request (you can record only one single request) using HTTP(S) Test Script Recorder.
Prepare JMeter for recording. The easiest way of doing this is using JMeter Templates feature
from JMeter main menu choose
File -> Templates -> Recording
and click "Create"expand HTTP(S) Test Script Recorder and click "Start"
Prepare your browser for recording, refer your browser documentation in order to set up proxy using
localhost
as the proxy host and8888
as the proxy port, the proxy needs to be set for all protocols with no exclusions. The relevant configuration for Mozilla Firefox (the only free and open source popular browser, moreover it has separate proxy configuration which does not derive from the operating system) would be:
Copy the file you will be recording to the "bin" folder of your JMeter installation. If you omit this step JMeter will not be able to properly record the request. See Recording File Uploads with JMeter article for more details if needed- Execute the request in browser - the relevant HTTP Request sampler will be generated under the Recording Controller
answered Nov 14 '18 at 6:17
Dmitri TDmitri T
75k33766
75k33766
Thank you Dmitri, I tried recording using HTTPS(S) Test script recorder, and after a few edits it worked properly in localhost. I also copied the difference to the generated script by blazemeter to make them identical. however when I run the blazemeter upload script, it was still unsuccessful dropbox link for the recorded scripts I would be creating the test script for the application server where I need to use the company proxy to connect to, so I was using blazemeter chrome extension for recording.
– Noreen Lazo
Nov 15 '18 at 3:20
Would there be any possible way to record script while using a company proxy? Or is there something I have missed when editing the blazemeter script to work properly like the generated script from HTTP(S) Test Script Recorder?
– Noreen Lazo
Nov 15 '18 at 3:21
The http request used for the file upload are the following: in blazemeter generated script: 6th http request; in jmeter Test Script Recorder: 7th http request
– Noreen Lazo
Nov 15 '18 at 3:27
Look into HTTP Header Manager for both scripts, there might be differences in i.e. Referer or Origin headers. With regards to recording test using JMeter via corporate proxy - it should not be a problem as well
– Dmitri T
Nov 15 '18 at 5:36
Upon checking, the jmeter generated script doesn't use a HTTP Header Manager, so I also removed the header manager in blazemeter script. I checked the request headers generated when running both scripts, and I noticed that there are discrepancies in Content-type request header. [Picture of request headers for both scripts. ](i.imgur.com/yyRZYxP.jpg) On the left side (jmeter) the highlighted strings are the same, but on the right side (blazemeter), they are different. Is it possible that the Content-type header is causing the problem...? If so, would there be a way on how to solve it?
– Noreen Lazo
Nov 15 '18 at 8:05
|
show 2 more comments
Thank you Dmitri, I tried recording using HTTPS(S) Test script recorder, and after a few edits it worked properly in localhost. I also copied the difference to the generated script by blazemeter to make them identical. however when I run the blazemeter upload script, it was still unsuccessful dropbox link for the recorded scripts I would be creating the test script for the application server where I need to use the company proxy to connect to, so I was using blazemeter chrome extension for recording.
– Noreen Lazo
Nov 15 '18 at 3:20
Would there be any possible way to record script while using a company proxy? Or is there something I have missed when editing the blazemeter script to work properly like the generated script from HTTP(S) Test Script Recorder?
– Noreen Lazo
Nov 15 '18 at 3:21
The http request used for the file upload are the following: in blazemeter generated script: 6th http request; in jmeter Test Script Recorder: 7th http request
– Noreen Lazo
Nov 15 '18 at 3:27
Look into HTTP Header Manager for both scripts, there might be differences in i.e. Referer or Origin headers. With regards to recording test using JMeter via corporate proxy - it should not be a problem as well
– Dmitri T
Nov 15 '18 at 5:36
Upon checking, the jmeter generated script doesn't use a HTTP Header Manager, so I also removed the header manager in blazemeter script. I checked the request headers generated when running both scripts, and I noticed that there are discrepancies in Content-type request header. [Picture of request headers for both scripts. ](i.imgur.com/yyRZYxP.jpg) On the left side (jmeter) the highlighted strings are the same, but on the right side (blazemeter), they are different. Is it possible that the Content-type header is causing the problem...? If so, would there be a way on how to solve it?
– Noreen Lazo
Nov 15 '18 at 8:05
Thank you Dmitri, I tried recording using HTTPS(S) Test script recorder, and after a few edits it worked properly in localhost. I also copied the difference to the generated script by blazemeter to make them identical. however when I run the blazemeter upload script, it was still unsuccessful dropbox link for the recorded scripts I would be creating the test script for the application server where I need to use the company proxy to connect to, so I was using blazemeter chrome extension for recording.
– Noreen Lazo
Nov 15 '18 at 3:20
Thank you Dmitri, I tried recording using HTTPS(S) Test script recorder, and after a few edits it worked properly in localhost. I also copied the difference to the generated script by blazemeter to make them identical. however when I run the blazemeter upload script, it was still unsuccessful dropbox link for the recorded scripts I would be creating the test script for the application server where I need to use the company proxy to connect to, so I was using blazemeter chrome extension for recording.
– Noreen Lazo
Nov 15 '18 at 3:20
Would there be any possible way to record script while using a company proxy? Or is there something I have missed when editing the blazemeter script to work properly like the generated script from HTTP(S) Test Script Recorder?
– Noreen Lazo
Nov 15 '18 at 3:21
Would there be any possible way to record script while using a company proxy? Or is there something I have missed when editing the blazemeter script to work properly like the generated script from HTTP(S) Test Script Recorder?
– Noreen Lazo
Nov 15 '18 at 3:21
The http request used for the file upload are the following: in blazemeter generated script: 6th http request; in jmeter Test Script Recorder: 7th http request
– Noreen Lazo
Nov 15 '18 at 3:27
The http request used for the file upload are the following: in blazemeter generated script: 6th http request; in jmeter Test Script Recorder: 7th http request
– Noreen Lazo
Nov 15 '18 at 3:27
Look into HTTP Header Manager for both scripts, there might be differences in i.e. Referer or Origin headers. With regards to recording test using JMeter via corporate proxy - it should not be a problem as well
– Dmitri T
Nov 15 '18 at 5:36
Look into HTTP Header Manager for both scripts, there might be differences in i.e. Referer or Origin headers. With regards to recording test using JMeter via corporate proxy - it should not be a problem as well
– Dmitri T
Nov 15 '18 at 5:36
Upon checking, the jmeter generated script doesn't use a HTTP Header Manager, so I also removed the header manager in blazemeter script. I checked the request headers generated when running both scripts, and I noticed that there are discrepancies in Content-type request header. [Picture of request headers for both scripts. ](i.imgur.com/yyRZYxP.jpg) On the left side (jmeter) the highlighted strings are the same, but on the right side (blazemeter), they are different. Is it possible that the Content-type header is causing the problem...? If so, would there be a way on how to solve it?
– Noreen Lazo
Nov 15 '18 at 8:05
Upon checking, the jmeter generated script doesn't use a HTTP Header Manager, so I also removed the header manager in blazemeter script. I checked the request headers generated when running both scripts, and I noticed that there are discrepancies in Content-type request header. [Picture of request headers for both scripts. ](i.imgur.com/yyRZYxP.jpg) On the left side (jmeter) the highlighted strings are the same, but on the right side (blazemeter), they are different. Is it possible that the Content-type header is causing the problem...? If so, would there be a way on how to solve it?
– Noreen Lazo
Nov 15 '18 at 8:05
|
show 2 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53293852%2fhow-to-upload-file-in-a-jsf-application-using-jmeter%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown