Jmeter script recorder and recording for multiple users/threads - multithreading

I created in Jmeter a Test Plan that looks like that:
the idea is to keep track of all the APIs the browser access between two pages. So, I open the localhost:63948/Home/LoginEmailSenha and I go until the other page I want. Under the Recording Controller label I get the list of the APIs.
But what can I do so that it feels like there isn't only one person accessing but actually 200? I tried to change the Number of Threads(users) at the Thread Group but nothing seems to change as I want to get the API errors that occured because there are too many people.

HTTP(S) Test Script Recorder is used to create a test scenario "skeleton", it basically stands between browser and application under test, captures requests and generates relevant HTTP Request samplers.
If you need to mimic 200 users you need to replay the recorded scenario with increased number of threads.
References:
JMeter Proxy Step by Step
Building a Web Test Plan
Building an Advanced Web Test Plan
If your target is to simulate the load during recording time you can take a look at JMeter Chrome Extension, it has FollowMe Mode when any your online activity is replicated with a given number of virtual users.

Related

how to script for sharepoint app using jmeter for performance testing

I am having a SharePoint-based application, using which I need to perform load testing.
But When I m recording the script, the response is not as same as the browser, and thus unable to get what needs to be done
And in first 2 requests:
get page
post login
in these, there is no dynamic value, so I am not able to understand it.
First of all add HTTP Cookie Manager to your test plan
Second check all fields of the request from the browser (i.e. using browser developer tools) and JMeter and pay attention to URL and Headers
And last but not the least very often Sharepoint installations are protected using NTLM or Kerberos, if this is the case you will need to add properly configured HTTP Authorization Manager, see Windows Authentication with Apache JMeter article for more details.

Scalability for intensive pdf generation tasks on a node.js app using puppeteer?

The goal of the app is to generate a pdf using puppeteer, we fetch the data, build the html template then using chrome headless generate the pdf, we then, return a link to the newly generated pdf.
The issue, is it takes about 7000 ms to generate a pdf, mainly because of the three puppeteer functions : launch (launch the headless broweser), goto (navigate to the html template) and pdf (generates the pdf).
So having around 7~8 seconds to answer one request, with more incoming requests or a sudden spike, it could easily takes about 40 to 50 seconds for 30 simultaneous requests, which I find unacceptable.
After many time spent on research, I will implement the cluster module to take advantage of multiple processes.
But besides clustering, are there any other possible options to optimize the time on a single instance?
There are something to consider ...
Consider to call puppeteer.launch once per application start. Your conversion script will just check is browser instance already exists and use it by calling newPage(), which basically create new tab, instead of every time creating the browser.
You may consider to intercept Request as page.on('request', this.onPageRequest); when calling goto() and filter out certain types of the files which page is loading right now, but you don't need them for PDF rendering; you may filter out external resources as well if this is your case.
When use pdf() you may return back Buffer from your service, instead of using file system and return link to the location of PDF file created. this may or may not speed up things, depend on your service setup; anyway less IO should be better.
This is probably all you can do for single instance of your app; With the implementation above regular (couple of pages) PDF with a few images render for me in 1-2 sec.
To speed up things use clustering. Other than embed it inside your application you may consider to use PM2 manager to start and scale multiple instances of your service.

Unable to log in to Azure web app via VS2015 web performance test

How do I correctly handle the login/authentication scenario for an Azure web app in my VS2015 web performance test?
I created an XML file as a data source for the WAAD username and password. I bind the username and password to the Form Post Parameters: login and passwd respectively at request: https://login.microsoftonline.com/xxxx/login
But when I run the test, the Web Browser tab shows this error:
We can't sign you in
Your browser is currently set to block JavaScript. You need to allow
JavaScript to use this service.
To learn how to allow JavaScript or to find out whether your browser
supports JavaScript, check the online help in your web browser.
I also get a number of errors like this:
The value of the ExpectedResponseUrl property
Validation xxxx.azurewebsites.net/xxxx/docs/xxxx.aspx does
not equal the actual response URL
login.microsoftonline.com/xxxx/wsfed. QueryString
parameters were ignored.
Any idea how I can successfully log in to the Azure web app via the web performance test?
There are several methods of login and authentication that can be used. Just binding values to form post parameters may not be sufficient or correct. You will find the login form has hidden session identities that must be passed as well as the login data. I find that recording a test two times using as nearly as possible the same inputs and doing the same activities helps. These two tests can then be compared to find the dynamic data that needs to be handled.
In a comment the questioner added "I noticed these parameters, n1-43 are different but I have no idea what they represent. How do I handle them?". I can have no idea what they represent as I do not know the website you are testing. You could ask the website developers. Or, better, treat them as dynamic data. Find where the values come from, save them into context variables and use them as needed. This is basic web test development. Here and here are two good articles on what to do.
The message about JavaScript not being supported can be ignored. Visual Studio web tests do not support JavaScript or any other "active" parts of a web page, they only support the html part. Your job as a tester is to simulate what the JavaScript does for the specific user journeys you are testing. That simulation is generally just filling in the correct values (via context parameters) in the recorded requests.
Unexpected response urls can be due to earlier failures, such as teh login not working. I suggest not worrying about them until all of the other test problems are solved. Then, if you need help ask another new question.

ASP.NET WEBAPI MVC service return to page and keep processing asynchronous multthreading?

We have a WEBAPI service running on a windows asp.net MVC solution. There is a load method that takes about 40 minutes to complete and return status on the called page. During that time the browser window is tied up. What design options do we have if we want the web page to come back with submitted and the process to continue to run and complete. I don't care if page never shows complete, we can pull that from another status page.
I've done something similar in the past, even though in my case the delay was shorter - 40-50 seconds of loading of fresh data from multiple backend servers in a VPN. It was also in ASP.NET back then, but I believe that the approach is still feasible and you can get some ideas if I share my experience. I remember an old thread that I had favourited in the past and used the insight from it. You can check it out.
Here are some tips, but in short, because I don't remember the details anymore (excuse my google-assisted memory!):
You should start the task in a new thread and not wait for it in your main thread.
You should also make sure that the task is started only once and cannot be initiated infinite number of times by the user via refresh or via the UI. So, you better persist the state in the database, so at refresh, the new thread is created only if the database says that it has not been executed recently or it is not in progress.
Your page will be loaded and show its contents and you can display a .gif representing a progress bar, a loading wheel or something similar to the user.
The task you started will continue on the server. When it completes you can push and update the UI via ajax from within the code-behind to make the experience even smoother if you like.
On subsequent requests, you can just retrieve the state of your task from the database in order to display something like update completed at hh:mm:ss.
Hope this helps you and I wish you the best of luck!

jmeter auto create user/password account

I'm trying to use jmeter to simulate 500 usernames/passwords being created on a test site I have. The home page has 3 fields, username,email address, and password. How can I get jmeter to auto-fill those fields?
The next question is can jmeter then go to the next page and fill in credit information for example?
One thing to note here is JMeter is not like QTP / Selenium. It is not a pure functional testing tool.
However, It can be used for functional testing when you know how to use it!
For your question,
Record the http requests for creating the user and entering the credit information. Check this for more information. http://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf
Then update the recorded scripts to parameterize the username, password email etc
Then you can update the loop count to rerun it again and again to create the data you want to create
JMeter is an excellent tool for performance testing, functional testing and for creating test data etc.
JMeter has possibility to use either external pre-defined data or generate some random values.
To use existing username/password/email combinations there are following options:
CSV Data Set Config- to read information from CSV files
JDBC PreProcessor - to fetch information from any database which supports JDBC protocol
StringFromFile - to read a string from file
CSVRead - similar to CSV Data Set Config
RandomString - to generate a random string
In regards to "go to the next page", it is also possible given that you have a HTTP Cookie Manager
Remember that JMeter acts on protocol level so you'll need to properly construct HTTP Requests.
The best way to trace execution and visualize requests/responses is using View Results Tree listener.

Resources