In the past I wrote most of my unit tests using C# even when the actual software development was in another .NET language (VB.NET, C++.NET etc.) but I could use VB to get the same results. I guess the only reason I use C# is because most of the examples in the internet are written in C#.
I you use unit tests as part of .NET software development what language do you prefer to use and what is the reason you choose to use it?
I know that it depend greatly on the language of the proect under test but what I'm interested in finding out is whether there is a preference of a specific language to use while unit testing.
You should use what ever language is comfortable for your dev team.
I don't see what you would write your unit tests in a language other than the language that the rest of the project is written in as it would have the possibility to cause confusion, or require devs know two different languages to work on the project.
Tests should follow the KISS principle.
C# because that is what all new code base is being written in. I would say it largely depends on what the companies preferred language is. If possible I think it best to fix on one if possible and this would also be what tests are written in too. And if only a few write in C++ then keep the more common languages still as tests so more could work well with them.
I write all my .Net application/business code in C#, so it is quite natural to write the unit tests in C# as well. I think that writing the test code in another language introduces an unnecessary separation between the test code and the application code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With