-2

I'm doing a web api project in MVC in which i want to test the maximum hit limit of web api method which is 2500 per day. i want to test this limit by hitting url at 2500 times but i don't get any proper solution yet. The url of my web api method is: http://localhost:63091/api/CustomerSite/GetSiteList?accessToken=123456789 Suggest me any online tool or guide me through any js script. Thanks in advance.

uxman ali
  • 43
  • 2
  • 8
  • Sounds for me like load testing, but not really getting the grasp of your question here. With which technologies are you working, what has the question to do with the MVC pattern at all? Not getting it, sorry man.... – Lucas Jahn May 31 '18 at 14:57
  • 1
    You can easily write a C# console app to [make the requests](https://stackoverflow.com/questions/27108264/c-sharp-how-to-properly-make-a-http-web-get-request). There's also lots of third party scale and pen testing services which will do this in a more distributed and controlled manner if you take the time to research. – Rory McCrossan May 31 '18 at 14:58
  • From your tags sounds like your using C#. You can make a small program to call your website. Once you've been able to do that once you should be able to add it to a for-loop and make a count to 2500+. – Esaith May 31 '18 at 14:58
  • i m working in mvc in which i'm developing a web api. – uxman ali May 31 '18 at 14:58
  • I think @RoryMcCrossan has a good solution. – Esaith May 31 '18 at 14:59
  • Possible duplicate of [Curl Command to Repeat URL Request](https://stackoverflow.com/questions/12409519/curl-command-to-repeat-url-request) – Reactgular May 31 '18 at 15:06
  • [Using Fiddler](https://stackoverflow.com/questions/16101483/can-i-send-multiple-requests-at-one-time-using-fiddler) Using fiddler is the best option to debug your API. – Debashish Saha May 31 '18 at 17:26

3 Answers3

1

Postman is an excellent tool to send requests and test an API. You can use the collection runner to run a request multiple times. You can find the full guide here: https://www.getpostman.com/docs/v6/postman/collection_runs/running_multiple_iterations

Ace
  • 26
  • 4
1

You could install Apache Bench on your local machine and use that.

Here is a quick article that walks you through using this tool.

Sage
  • 4,769
  • 1
  • 21
  • 28
-1

You can do this in javascript you can create a .js file for this and include that in .html file and access that file on the browser:

for (i = 0; i < 2500; i++){
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
        if (this.readyState == 4 && this.status == 200) {
            //do Something
        }
    };
    xhttp.open("GET", "http://localhost:63091/api/CustomerSite/GetSiteList?accessToken=123456789", true);
    xhttp.send();
}
Aniruddh Agarwal
  • 900
  • 1
  • 7
  • 22