It's one of the most common questions we get:
Which is course is best for me, our Test Automation course in Python or our Test Automation course in Java? And why do we run the course in two different languages?
The first and most import point to say is: it does not matter which language you automate in.
The application you want to test can be written in Java, Python, CSharp, Assembly, Scala or any other computing language you can think of. An automation framework written in Python will automate your manual tests and an automation framework written in Java will also automate your manual tests just as well. When it comes to automating the GUI, the underlying framework makes no difference.
Which course to choose depends on your situation. Of course, if you wish to become an automation expert, you probably want to take both as the frameworks are very different. Each fit different circumstances, as you'll see below, and sometimes it simply comes down to personal preference.
I've tried to break down the pros and cons of each in the hope that this makes your decision easier. If it's made it more complicated, I'm sorry.
Python is Perfect.
Automate your world not just your tests. It's hard to make the move to becoming a technical tester without knowing Python. If there's one language you need to know to automate EVERYTHING, then this is the one to choose. You can automate spinning up environments, you can use it to scan ports and perform security tests, for CI it's invaluable. Python will become a friend you revisit again and again.
Short and simple. It laughably easy to use and read compared to Java's complex syntax. In addition: it's generally accepted that for every ten lines of code in Java you only need one line in Python.
Everyone's already done everything for you. So many other people use Python for the exact reason you do, so you can generally assume that some's already written the code you need and you can simply import it.
Learning and support. There's a huge amount of learning and support materials out there on the Web. People generally agree that the support manuals are easier to understand than for any other language.
IDE pain. Python is designed to be simple, versatile and scripted from the interpreter, so it doesn't play as well with IDEs as Java does. It's so simple and versatile that it's impossible for an IDE to understand what you're doing when you start creating objects and passing them around between methods. This can be very frustrating if you do want to use an IDE to create your framework.
Office support. Sometimes it's better to have local support. If no-one else in your office has Python knowledge, there's no-one to bounce questions off when you get stuck.
Java is Just Right.
IDE heaven. Java is a joy to code in IDEs such as IntelliJ. The IDE does most of the work for you, even taking most of the pain of the complicated syntax. The code completion features mean you can get a huge amount of work done while it feels like you've only typed a couple of characters.
PageFactory. Page Factory in Java simplifies your Selenium automation code and allows you to write easily understandable tests.
In-house support. Most testers work with Java developers. If you ever get stuck, there's someone a couple of desks away who can pop over and give you hand. This helps hugely with the learning curve and also gives you the benefit of their experience and knowledge. Before you know it, you'll be a pro.
Gibberish. It's not at all easy to read Java compared to the plain English of Python. There's also a steep learning curve and the documentation isn't always that useful. There's a lot of online support though (see Stack Overflow).
Null Pointer pain. When Java throws an error and stack trace at you it's not always the easiest to understand or the most useful. IntelliJ helps where it can, but confusing error messages can make it frustrating to debug.
Limited to Test Automation. You'll never use Java in any other areas of your testing. Not in CI, Performance, Security, Availability or anywhere else. You're stuck automating the GUI of your application and that's it.
I hope this has helped! If it's only made you more confused, please don't hesitate to get in touch with one of the education team at firstname.lastname@example.org or by calling us on +44 (0) 2921 28 0321. We're always happy to have a chat.