Testing a JSF Application with JMeter - jmeter

I am a trying to execute a test script for a JSF application.
I have followed the steps in from the below link:
wiki.apache.org/myfaces/PerformanceTestingWithJMeter
My script is navigating through 5 pages. The issue is i am able load all the 4 pages without any issue, but i am getting view expired exception for one page.
Structure
Thread Group
|- HTTP Cache Manager
|- HTTP Cookie Manager
|- HTTP Header Manager
|- Once Only controller (Login)
|- HTTP Request(Login page)
|- Regular Expression Extractor (For the view ID)
|- Recording Controller
|- HTTP Request (Page 1.faces)
|- Recording Controller
|- HTTP Request (Page 2.faces)
|- Recording Controller
|- HTTP Request (Page 3.faces) -> Getting Error for this page and the response is blank.
|- HTTP Request (Page 4.faces)
|- Recording Controller
|- HTTP Request (Page 5.faces)

Related

JMeter - Test not running on second call at run time

I have set my tests up in the following layout:
Test Plam
Test Fragment
EP-1(include controller)
EP-2(include controller)
EP-3(include controller)
Thread Group
Parameterized controller
Module Controller
EP1
Parameterized controller
Module Controller
EP2
Parameterized controller
Module Controller
EP1
Parameterized controller
Module Controller
EP3
View Results Tree
Results:
EP1
EP2
EP3
When running these tests i only get EP1 running once and doesn't run a second time (doesn't even look like it attempts to run)
No information in JMeter log apart from loaded (include controller)
I added the HTTP request directly and have the same issue so did the following set up:
Test Plan
Test Fragment
EP-1(include controller)
EP-2(include controller)
EP-3(include controller)
Thread Group
Parameterized controller
EP1
Parameterized controller
EP2
Parameterized controller
EP1
Parameterized controller
EP3
View Results Tree
Still got the same result. Any ideas?
New:
OUTPUT of this is:
JWT Token
Include Controller1 (PUT)
Include Controller2 (GET)
HTTP Request (PUT)
Include Controller1 (PUT)
HTTP Request (GET)
Include Controller1 (PUT)
Expected:
JWT Token
Include Controller1 (PUT)
Include Controller2 (GET)
HTTP Request (PUT)
Include Controller1 (PUT)
Include Controller2 (GET)
HTTP Request (GET)
Include Controller1 (PUT)
HTTP Request (GET)
Include Controller2 (GET)
I cannot reproduce your issue using latest stable JMeter 5.2.1 and your test plan structure with simple single Dummy Samplers under the Test Fragment in the each included file.
I configured the included Samplers to display current Thread Group iteration using __threadGroupName() and __V() functions combination like:
${__V(__jm__${__threadGroupName}__idx,)}
and as you can see everything is executing just fine:
Turns out the Cache Manager was caching the (GET) request (checkbox)
unchecked that and it worked.
Hopefully this helps anyone having a moment when writing these tests and unable to work out why the following (GET) requests are not being excuted.

JMeter HTML report - HTTP requests named <name>-0, <name>-1 <name>-2 etc - Why?

I have two thread groups in my project, and on of them has two HTTP request samplers. It's set up like the following
Thread group
Timer: Random between 1 and 5 minutes: ${__Random(60000,300000)}
HTTP request: A basic GET web service call
HTTP request: A basic GET web service call
Here's the Thread group setup.
That's it. Here's an example of the web service call setup
And here's what the "Statistics" portion of the HTML report looks like. Note the -1, -2 after the HTTP Request names. I'm trying to figure out why that's happening.
My other thread group / samplers are not displaying that way, but they're set up the same way, as far as I can tell.
In your example, HTTP requests Get Locations-0, Get Locations-1 are sub requests of Get Locations which appeared since you have selected the check box - Follow Redirects.
In case, you don't want HTTP requests Get Locations-0, Get Locations-1 to appear in your HTML report:
In the listener page(where you have saved the result file; which is the source file of HTML report) -> click on configure button -> uncheck the Save Sub Result option
You can also refer :Configure result file to customize HTML report
Turns out that some of the calls were returning a 200, others a 301, that's where they got separated out, even though the 301's didn't register as errors in the report.

ajax request gives a 404 with express server (chrome) loads successfully with firefox without a server?

I'm trying to issue an ajax request from my index view .
.
├── app.js
|
├── package.json
├── ajax
│ ├──ajax.txt
|
├── home.ejs
server is just renders the home page
app.set('views' , './');
app.set('view engine' , 'ejs');
app.get('/' , function(req , res){
res.render('01');
});
-ajax script loads fine in firefox without a server .
- making an express server it give a 404
GET http://localhost:3000/ajax/ajax.txt 404 (Not Found)
home simple issues a request when button is clicked .
var loadAjax = document.getElementsByTagName('button')[0];
loadAjax.addEventListener('click' , function(e){
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){
if((xhr.readyState == 4) && (xhr.status == 200 || xhr.status == 304)){
var rText = document.createTextNode(xhr.responseText);
var p = document.createElement('p');
p.appendChild(rText);
document.body.appendChild(p);
}
};
xhr.open('GET' , 'ajax/ajax.txt' , true);
xhr.send(null);
From the Express code you show, there is no route handler that responds to a request for http://localhost:3000/ajax/ajax.txt.
An express web server does not serve any files by default. So, it only serves files that you have created an explicit route handler for or you have configured some sort of middleware to serve one or more static files in an automatic fashion. So, unlike some other web servers, Express does not just look in your server file system for a matching file to send back to the requesting client. If there's no route or middleware explicitly designed to handle that particular request, you get a 404.
You can use app.use(express.static(...)) to configure some static file handling for Express. For example, you can configure it to automatically serve a whole directory of static and public files. For example, this is often used to serve .css and .js files which are usually static files.
For example, a simple Express route to handle just your /ajax/ajax.txt request would look like this:
app.get("/ajax/ajax.txt", function(req, res) {
res.sendFile("ajax/ajax.txt");
});
Depending upon what else you want to do with static files, you could also use express.static() middleware to configure one or more static files to be automatically served by your Express server. See the doc for the various options and ways to use it.

JMeter failed url attempts followed by correct url for HTTP Request

How can I get JMeter to only attempt 1 url instead of 5 each time I run a test?
I am using a different site which is internal, but let's say I was using "blah.com" for the sake of discussion.
I see this in the View Results Tree:
http://blah.com
https://blah.com
https://blah.com/abc
http://blah.com/abc
https://blah.com/abc
In the same order, here are my http response codes:
301 Moved permenantly
301 Moved permenantly
302 Found
301 Moved permenantly
200 Ok
If I want Jmeter to just go straight to the 5th one so that I get the 200 code right away, what do I have to do in JMeter settings?
I have:
HTTP Cookie Manager
HTTP Cache Manager
HTTP Request ( with "blah.com" filled in for the server name )
under HTTP Request, I have all of these:
HTTP Header Manager
Response Assertion ( with some url patterns checking for html tags - I just copied the html from View Source and pasted it in as a url pattern...these all seem to work )
Response Assertion ( just checking response code - I chose Response Code and entered "200"...this also seems to work )
Summary Report
I was able to get this down to 1. Adjustments made to the HTTP Request:
I added "/abc" to "Path" and changed "Follow Redirects" to "Redirect Automatically".

JMeter - File upload and file download scenario

I am using JMeter to do performance test a web page.
I have a scenario for uploading a file and downloading a file. I need to load test uploading file and downloading file scenarios.
Can any one help me how to achieve these using JMeter.
Thanks,
Raj
There are actually no difficulties in recording upload/download traffic with any HTTP sniffing tool and then emulate recorded requests in using JMeter.
In the simplest case you will get something like the following:
Thread Group to setup number of test users and loops;
for upload: 1 HTTP POST request with Use multipart/form-data for POST = true - to sent file as part of request;
for download: 1 HTTP GET request for download + Save Responses to a file listener attached to it - to save requested file.
This will look like the following:
Thread Group
Number of Threads = X
Loop Count = Y
. . .
UPLOAD HTTP Request
Method = POST
Use multipart/form-data for POST = true
-- Send Files with Request -- section:
File Path = ${testFile}
Parameter Name = datafile
MIME Type = ...
. . .
DOWNLOAD HTTP Request
Method = GET
Save Responses to a file
Filename Prefix = downloadTest_
Variable Name = testFile
. . .
Here you can find sample script implemented for schema given above: file-upload-download.jmx.
The following posts may also appear useful:
Testing load document functionality with JMeter
Performance testing: Upload and Download Scenarios with Apache JMeter
How to Test Image Upload Functionality With JMeter
JMeter Testing Multiple Random File Uploads
Handling File Upload in JMeter

Resources