Test Automation: Java or Python?

Hello! In March, OTUS launches two test automation courses at once: “Python QA Engineer” and “Java QA Engineer”. We are often asked which of these courses to choose, we decided to answer this question by translating an article from SafeBear.


One of the most popular questions is:
What course should I take: on test automation in Python or on test automation in Java? And why do we have courses in both languages?

The first and most important thing to say: it doesn’t matter what language you are automating.

The application you want to test can be written in Java, Python, C #, Assembly, Scala, or any other programming language available. Automated testing frameworks in Python will automate manual tests no worse than Java frameworks. When it comes to GUI automation, it makes no difference which framework you are testing on.

Which course is right for you depends on your situation. Of course, if you want to become an automation expert, then you most likely will want to take both courses, since the frameworks still vary greatly. Each of them copes with its tasks, as you will see below, and sometimes, choosing a framework comes down to personal preferences.

I tried to make out the pros and cons of both of these frameworks, in the hope that this will facilitate your decision-making process. If after that the decision will be made only more difficult, then forgive me.

Python is perfect

pros

Automates your world, not just your tests. It is difficult to embark on the path of a tester without knowing Python. If there is such a language that you need to know in order to be able to automate EVERYTHING, then this is definitely Python. You can automate the deployment of the environment, use it for port scanning or conduct security testing, for CI it is indispensable. Python will be your friend, whom you will turn to for help again and again.

Short and simple. Compared to the loaded Java syntax, it is ridiculously easy to use and read. It’s also a well-known fact that there are 10 lines in Java per line in Python.

For you already done everything. Many other people use Python for the same reason as you, from this we can conclude that someone already wrote the code that you need, and you can just import it.

Training and support. On the Internet you can find a bunch of training and useful materials. In general, people have come to the conclusion that Python materials are more understandable than any other language.

Minuses

Pain with IDE. Python was created to be simple, universal and to provide the ability to write scripts directly from the interpreter, so it does not get along with the IDE as well as Java. It is so simple and versatile that the IDE cannot understand what you do when you start creating objects and passing them between methods. This is an unpleasant feature that can play a role if you really want to use the IDE to create your framework.

Office support. Sometimes it’s better to have local support. If nobody in your team knows Python, then there will be no one to get emergency assistance in resolving issues that arise.

Java is what you need!

pros

Great IDEs. It’s a pleasure to write in Java in an environment such as an IDE from IntelliJ. The IDE does most of the work for you, even taking on the pain of complex syntax. The functions of code completion will do a lot of work for you, until it seems to you that you have typed just a couple of characters on the keyboard.

PageFactory. PageFactory in Java simplifies automation code for Selenium and allows you to write easy-to-understand tests.

Home support. Most testers work with Java developers. If you get stuck with something, after a couple of tables you will always be someone who will lend you a helping hand. It helps a lot on the learning curve, and gives you the benefits of the knowledge and experience of your colleagues. Do not have time to look around, as you become a professional.

Minuses

Abracadabra. It is not easy to read Java code compared to plain English Python. Java also has a very steep learning curve, and the documentation is not always useful. However, help on many issues can be found online (for example, at Stack overflow)

Pain c null pointer. When Java gives you an error message and displays a stack trace, it’s not always easy to understand what’s the matter, and sometimes this information is useless. IntelliJ helps where it can, but incomprehensible error messages can turn debug into a complete upset.

Limited to test automation. You will never use Java in other areas of testing. Not in CI, benchmarks for performance, security, availability, or anywhere else. You just get stuck in the automation of testing the graphical interface of your application and that’s it.

That’s all. We hope now it has become a little easier for you to decide which course to choose, but to consolidate your choice, we invite you to free lessons on courses:

Python QA Engineer
Java QA Engineer

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *