Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What .NET language you use to write Unit Tests? [closed]

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.

like image 762
Dror Helper Avatar asked Nov 30 '08 21:11

Dror Helper


3 Answers

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.

like image 93
Aaron Powell Avatar answered Oct 12 '22 06:10

Aaron Powell


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.

like image 2
dove Avatar answered Oct 12 '22 07:10

dove


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.

like image 1
Erik Öjebo Avatar answered Oct 12 '22 05:10

Erik Öjebo