Thread.Sleep should be a code smell in C# test cases

Within Java, Thread.Sleep() within test cases is a code smell, as can be seen here:

In C#, a similar language, this rule seems to be missing. If it could also be added to C#, that would be great!

I gave it a try: New Rule: S2925 Do not use Thread.Sleep() in a test by Corniel · Pull Request #6185 · SonarSource/sonar-dotnet · GitHub

Note that I’m a volunteer, and its up the to the .NET-team to review, and approve this. They have a loaded backlog, that might not allow to prioritize this. Furthermore, also some paperwork and documentation creation have to be done. Something we hardly can help them with.

1 Like