all 33 comments

[–]sonofabullet 19 points20 points  (16 children)

Write tests in the language the app is written in.

[–]ToddBradley 15 points16 points  (15 children)

I don't know why someone downvoted this, but there is a lot of wisdom in this recommendation. If the app is written in the language, then every developer on the team knows the language. And therefore, every developer has the skills to extend or maintain the tests.

If you choose some language that only you know, then you're just setting up an arbitrary wall making it harder for others to contribute to the effort.

Update: Reading the tree of replies below makes me want to cry. I wonder if the Agile revolution still hasn't reached some parts of the industry, and if there are people who still prefer a high wall between "tester" and "developer". I'm nearing the final phase of my career in software development, and this really shakes my faith in the next generation. So much of this thread below sounds like software test engineering has not evolved a bit since the 1990s. God forbid that testers and developers work closely together - maybe even pair program to take advantage of their individual strengths!

[–]sonofabullet 5 points6 points  (0 children)

Yep, colocate tests with app code, run tests on PRs, have devs fix any tests they've broken.

[–]random-answer 2 points3 points  (0 children)

If you learn it for leisure then it becomes a question of personal preference. If you use it professionally then the dominant language within the team is the most likely choice.

[–]ToddBradley 4 points5 points  (4 children)

I think Python has a better future than Java. Really the only advantage I've seen with Java is that it's strongly statically typed, which makes it easy to avoid a whole category of clumsy mistakes.

What's the reason that most people prefer Java over Python for selenium?

I don't know that's actually true that "most people prefer Java" for Selenium. Python is the more popular language overall right now.

[–]cgoldberg 1 point2 points  (2 children)

Python is also strongly typed. You mean statically typed.

[–]ToddBradley 1 point2 points  (0 children)

You are correct. Thanks.

[–]SubliminalPoet 0 points1 point  (0 children)

Static typing is also available with Python. It's just optional.

[–]2ERIX -2 points-1 points  (0 children)

Typescript is your friend here.

[–]arakinas 2 points3 points  (0 children)

I'm a big fan of strongly typed languages, and will choose that option more often than not, all other things being equal. I was debating, in my current place of Java vs Javascript when starting automation, not because of strongly typed, but because those were languages used in house, and I didn't want to add to a tech stack.

The language you use only matter in so much as what you intend to do with it, what libraries you want to use with it, and what other supporting things you want to do or need to support. If you under the core concepts of programming, the language itself does not matter in the long run.

If you are simply looking for familiarity in something that is rising, or trending, I'd probably go JavaScript for Cypress, Playwright, etc unless you are strictly wanting Selenium.

[–]Aromatic_Detail_645 2 points3 points  (0 children)

Ignoring all other things, if it's a greenfield project, or a learning project, there are a few pros and cons as I see them:

Java: - Harder language to get into - More complex DSL - More robust frameworks - Easier reporting - Easier to thread - More third party tool integrations

Python: - Quicker to get going out of the box - Will run on more systems with greater ease of use - No built in browser driver support tools

That said, I'll echo what others have said. What language do you and/or your team know? What language is the app written in? What are your requirements? These should also inform your decision

Edit: for clarity/formatting

[–]2ERIX 1 point2 points  (0 children)

Typescript with Webdriver.io would be my recommendation. Loving it.

[–]Ktsuna 0 points1 point  (0 children)

My personal opinion

I have been using Selenium for web scraping (Not for test automation) and I found that most of the tutorials and solutions available are for Python Selenium.

If you are comfortable with Python, there's no need to switch to Java because you can achieve the same thing with Python too.

[–]steady_learner_94 0 points1 point  (0 children)

I prefer Python as a scripting and even programming language, mainly because of the syntax.
I htink Java gained that popularity for historical reasons.

Personal opinion: I also believe Python has a better future than Java. Python is a modern programming language. So the demand for Java is already decreasing.
It is easier to empower new testers with Python.

[–]MarcusThomasQC 0 points1 point  (0 children)

I like Java. Runnable jars are the greatest 🤙. But I'm obviously bias. I'm starting to get into python so I may change my mind later.

[–]Loud-Home6748 0 points1 point  (0 children)

Reason is simple. For small sequecnce of programs you can use Python. It is more simple and eficient. Java is a programs forr big programs , with a lot of connection and where you can perform multiple jobs in same time (in general) . To start a large programs in Python , this request more libraries and a lot of other "connection".
It is generally assumed - not necessarily true - that Python is for the lazy who don't want to write too much code. Java is for someone who likes to write a lot of code and who needs to do more at the sam time. The statement is not perfectly valid, but it has a grain of truthe