How to do it...

Perform the following steps:

  1. Create a new HTTP trigger, named LoadTestHttpTrigger, with Authorization Level set to Anonymous.
  2. Replace the default code in run.csx with the following:
using System.Net;
using Microsoft.AspNetCore.Mvc;
public static async Task<IActionResult> Run(HttpRequest req, ILogger log)
{
System.Threading.Thread.Sleep(2000);
return (ActionResult)new OkObjectResult($"Hello");
}
  1. The preceding code is self-explanatory. In order to make the load test interesting, let's simulate some processing load by adding a wait time of two seconds, using System.Threading.Thread.Sleep(2000);.
  2. Copy the function URL by clicking on the </> Get function URL link on the right-hand side of the run.csx code editor.
  3. Navigate to the Load test tab of the Azure DevOps account. You can find it under the Test menu after you log in to Azure DevOps:

  1. Click on the New link and select URL based test, as shown in the following screenshot:
  1. In the Web Scenarios tab, provide a meaningful name for the load test, as shown in the following screenshot:
  1. Paste the HTTP trigger URL that you copied in step 4 into the URL input field, as shown in the following screenshot:
  1. Now, click on the Save button to save the load test:
  1. The next step is to provide details about the load that we would like to create on the Azure Function. As shown in the following screenshot, click on Settings and provide the details about the load test that you would like, depending on your requirements:
  1. Once you provide all your details for the load test, click on Save. Once you save the test, the Run test button will be enabled, as shown in the following screenshot:
  1. Click on Run test to start the load test. As the run duration of our load test is 20 minutes, it would take 20 minutes to complete the load test. Once the load is complete, Azure DevOps provides us with the performance reports, shown as follows:
    • Summary report: This provides us the average response time of the HTTP trigger for the load of 1K users.