What's your preferred code language for scripting?

Following on from this thread on what testers use script for, Iā€™m curious as to what languages people use to script, and how they come to choosing them.

3 Likes

My preferred language is Python :snake:, mainly because of its versatility.
There is even an adage for it: ā€œPython is the second-best language for everythingā€

4 Likes

My preferred code language for scripting is Python :wink:

4 Likes

My preferred code language for scripting is JavaScript

3 Likes

.Net/c#

A number of reasons:
Business - Company is an MS Gold partner, development code is in, sql server based applications, large legacy Regression test code based in .Net/c#

Personal:
I canā€™t really speak on comparing .Net/c# with other frameworks and languages, but I have some experience with Java and to a lesser degree python, and I find .Net/c# offers better support and packages for automation tests. But I am sure advocates of other languages would say similar.

Working with the same Frameworks and code as Dev Engineers does help in enhance the code base as they carry out my PRs. This also allows for collaboration with Unit Tests they write.

I would say ensuring that your code meets the same standards as production code(as far as is practical and makes sense), than the actual code used.
Writing in the same code as Dev Engineers will ensure the code follows correct patterns & principles, as well as your companies guidelines and best practices for code.

We donā€™t write Production code, but if your Quality relies on automated tests, then what we do produce is just as important.

Happy Thursday all :smiley:

3 Likes

Iā€™m not sure I have a favourite, I guess C++ is the most familiar as Iā€™ve had more years with C++ than any other.

For the most part Iā€™m usually constrained by the IDE and compiler that I can install on my PC. Using the same tools and language as the devs is usually an easy win, but trying to use a different language often comes with a lot of red tape. The easiest example is Powershell, it could be quite a powerful tool but itā€™s very rarely permitted. Iā€™ve not had much exposure to Python for the same reason, even installing the software will trigger a question ā€˜why?ā€™.

I use Python in Selenium and JavaScript in Cypress.

Mmmmā€¦should we debate on whatā€™s a scripting language?
Do C++/C# qualifying as one?

2 Likes

At least 2 responses include non script or ā€œnot interpretedā€ languages, and yes itā€™s a slippery slope between the two, but I think we all know what ā€˜script languageā€™ means, because even iron-python is a script language but is actually compiled, while java is actually converted and then run ā€œinsideā€ an environment or sandbox. But the question was script languages.

Python, and Powershell.
Why?
It is easy to email someone your code as some plain text, and have it still run all they have to do is save it as a text file.

  • There are really only 2 Python distros that matter v2 and v3, most code will just run fine under one of the two.
  • There are really only 2 Powershell distros, V1 and V2+, and you will struggle to install the older engine, so only the latest ever matters - unlike other languages which in my experience are fussier. (Yes Powershell is in version7 now, but itā€™s built in and has a package manager built in too.)

The main reason really, is that they have very strong operating system support making things like test environment configuration a walk in the park.

1 Like

no, we shouldnā€™t :sweat_smile: the question isnā€™t about which language is a scripting one but about which language you use for scripting :wink:

1 Like

My preferred language is Java. I have been using it so many years that Iā€™m comfortable with it.

I have started learning python recently and i find it relatively easier than Java. It was only because of my fear and own limitations that I didnā€™t use it earlier.

1 Like

Thank you Konstantin! :sweat_smile:

My current preference is:

  • shell (bash) for small things that only set up environment variables and call limited number of external processes. I draw the line at functions - if it seems I could use a function, I will reach for something else.
  • Python is the language I am most comfortable in, itā€™s basically my default language. Unfortunately, virtual environments tend to decay and I were in situations where I wanted to run some older code, but first I needed to recreate virtual env, maybe update some dependencies, and if Iā€™m unlucky, modify the code to work with newer dependencies. So I use Python when I know I wonā€™t need any external dependencies, when I work on something often enough to fight the project rot on ongoing basis, for project where development speed is more important (like prototypes) and for projects where I have high confidence I wonā€™t need to run them again in the future.
  • Rust for things that I donā€™t need to run often, but I want high confidence they will just work when I need them. As Iā€™m still learning and development takes me considerable time, for now this is limited to projects that are relatively small.
1 Like