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