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.
My preferred language is Python , mainly because of its versatility.
There is even an adage for it: āPython is the second-best language for everythingā
My preferred code language for scripting is Python
My preferred code language for scripting is JavaScript
.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
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?
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.
no, we shouldnāt the question isnāt about which language is a scripting one but about which language you use for scripting
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.
Thank you Konstantin!
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.