What is the Best Language for Software Test Automation?

What is the best programming language for writing software test automation? Like most things in life, it depends. In a .NET environment, your two best choices are C# and VB.NET. Because of the unifying effect of the underlying .NET framework, either language works very well and your choice will be based mostly on whether you feel more comfortable with C/C++/Java syntax (C#) or Visual Basic syntax (VB.NET). In a Microsoft, non-.NET environment your main choices are Visual Basic, C++, and Perl. All three languages have significant downsides. Visual Basic is easier to work with than the other two languages but it is less powerful, meaning the test automation you write will be less powerful. For example, writing UI automation with VB is rather awkward. C++ gives you the most power of the three language choices, but coding with C++ can be nightmarish, especially when dealing with pointers and memory allocation/deallocation. Perl is a compromise between the other two languages in terms of power and ease-of-use, so I consider it the best choice in most situations. I especially like the large number of libraries available when writing test automation with Perl.

In a non-Microsoft environment, your main choices are Perl, Java, and C++. As before, all three have pros and cons. Because of its inherently terse syntax, Perl is difficult to maintain. C++ gives you the most power but at the cost of complexity, which usually means it takes quite a bit longer to write automation with C++. Java is a good compromise in many non-Microsoft test automation scenarios. A relatively recent, fourth programming language choice for non-Microsoft software test automation is Ruby. I’m not a big Ruby fan myself, but some of my colleagues, whose opinions I respect, tell me Ruby is much like an improved Perl. As soon as Ruby libraries mature a bit, I intend to take a serious look at Ruby for test automation in both Microsoft and non-Microsoft environments.

Let me note at least one specific exception to my opinions in this entry. If you are testing software components which are intended to be called by multiple languages (like a general math library for example), you should test those components using multiple languages. And finally, the usual disclaimer: no one programming language is the best choice for all test automation situations. The more languages you can use for automation, the better. But the reality is that you only have so much bandwidth to learn technologies so you should think about issues like the one I’ve presented here so you can be most efficient with your personal skill upgrade strategy.

About these ads
This entry was posted in Software Test Automation. Bookmark the permalink.