Back in time when I worked on huge Visual Studio solutions/projects in Visual Studio that took over 1 minute to build or to unit test, what I did, I took a little break to bring more coffee, I was always coming back watch if the unit test was done or nor. I found recently that Visual Studio 2022 are able to play sounds for example when a build is done successfully or when a unit test fails or succeeds.
It can of course be frustrating to have sound on all the time, and re hearing it all the time. But in some situation where you need to be notified to continue your work, this feature might be interesting to turn on when needed and turn off when not.
Any way, it is very simple, In your Visual Studio 2022:
Step1: Tools -> Options
Step2: Locate Test -> General
Step3: Click on Configure Sounds button
Step4: Scroll down to Microsoft Visual Studio, you will have 6 sound to set, for instance I have not set my Breakpoint Hit, but I have set other sounds for example When Test Run Failed I play Alarm01.wav. etc.
Step5: Check Play a sound when tests finish running and click on OK.
In addition to above, you can in any version of Visual Studio or Visual Studio Code by using default C#
Console.Beep(), it creates beep sound. You can use that to indicate ending of test. By default
Console.Beep(); has no parameter with default values, but you can customize it by adding frequency and duration like
Console.Beep(370, 1000); where frequency should be between 37 and 32767 and duration are in millisecond, meaning 1000 is equal to 1 second.
That is it. Enjoy your sounds 😃
To improve your .NET Productivity with Visual Studio 2022, check this link.
To improve your Visual Studio 2022 testing features, check this link.