Send HTTP request with the Performance Toolkit
With the Performance Toolkit you can test your performance inside Business Central. But in the modern world Business Central is not on his own. There are dozens of interactions with other systems. And you want to test that also for your performance. Well that is also possible with the Performance Toolkit! In this blog I will show you:
– Get
– Post
– Patch
For this example I have created a custom API page based on the customer table:
Also I have created two simple function to get the access token (using Oauth2) and sends the http request. The code (the two function on the bottom) you can find here:
PerformanceTest/LibraryGraphMgt.Codeunit.al at master ยท Bertverbeek4PS/PerformanceTest (github.com)
Then for the GET request I have also created a seperate codeunit. This codeunit is very simple and lean:
When you publish the extension and run the BCPT suite you get the following “Log Entries”
You can see that there is only a duration but no “No. of SQL Statements” is shown. That is because we just send the HTTP request and the BCPT suite cannot grab the “SQL Statements”.
For the post you can do exactly the same, but we must add the body to the HTTP request.
And if your run this also in the BCPT suite you get also the “Log Entries” with the “No. of SQL Statements” zero:
And the last one is the patch test:
Now in the “Log Entries” you see that the “No. of SQL Statements” isn’t zero:
That is because we are getting a random customer to change the name.
So now you can extent your performance testing in Business Central with a real load including HTTP requests!
The source of this you can find here:
Bertverbeek4PS/PerformanceTest (github.com)
Leave a Reply