Visual Studio Code And The Performance Toolkit
As you maybe know Microsoft has introduced the Performance Toolkit earlier to measure what the performance of you app will do when an X number of users doing a scenario and other users doing something else.
More info on the Performance Toolkit you can find here:
Performance Toolkit – Discover Microsoft Business Central (bertverbeek.nl)
Performance Toolkit Extension – Business Central | Microsoft Learn
Previously it was sometimes a struggle to install and run the Performance Toolkit setting up an app registration etc. Microsoft has listen to this voice and has introduced an extension inside Visual Studio Code to do all the work for you. With this case a developer can also do easily write test codeunits to look if his feature is performance enough.
You can download and install the new extension for VS code here:
Performance Toolkit – Visual Studio Marketplace
With this extension you get three commands to do your work:
Setup new Business Central Performance Toolkit project
Whit this commando you are going to setup a new project.
You can choose for a connection with your SaaS environment or your Docker (Windows authentication is only supported). On-premise isn’t supported.
But since everybody uses Docker to develop I don’t see any problems there.
When you choose for SaaS you can choose which environment you want to connect to (after you have authenticated).
Then it will try to install the Performance Toolkit in the environment if it is not installed.
Sometimes this step wil fail for certain reasons. If it is failing you can easily go to extension management and install it from there.
After that is will renumber all the provided sample codeunits from Microsoft. This renumbering looks to all installed extensions and picks a free number range.
Be also aware that these sample codeunits are now inside the VSIX project. They are not coming from:
ALAppExtensions/Other/Tests/BCPT-SampleTests/src at main ยท microsoft/ALAppExtensions (github.com)
That will be a nice feature to add!
When everything is setup you will get a notification and you can start developing your own codeunits.
Run BCPT (PowerShell)
Since the PowerShell scripts are also provided in the project
You can also run you performance test from Visual Studio Code!
For the authentication part it will take the same approach as the AL extension. In this case it can also handle two-factor authentication! With the original PowerShell script you must switch that off.
Once you have setup your BCPT suite you can start is from VS Code:
For this choose the option BCPT: Run BCPT (PowerShell).
It will ask again your environment and your Suite Code:
After that in the bottom of your screen it will start the test:
And in BC you will see that it is running:
So now you don’t have an excuse to run your performance tests 😊
Leave a Reply