Should I learn Python or Java to get into test automation?
I'm new to programming. Please share your thoughts or links to any useful information.
Should I learn Python or Java to get into test automation?
I'm new to programming. Please share your thoughts or links to any useful information.
Since you are looking into Selenium (as a test framework) start with Java, because Googling on "Selenium/Webdriver issue description" will often result in Java examples that you can re-use. There is just more people doing Selenium with Java then Python. Also Selenium it-self is mainly written in Java.
For a project I would learn the language the application (under test) is written in. As a tester your are often not a hardcore programmer, thus if you need assistance with the test automation its ideal if the team can help you in a language they use on a daily basis and have the most experience with. This will also increase the adoption and extension of your tests by the developers, they will have to maintain/extend the tests in the end probably.
If your learning preference is from books I suggest "Thinking in Java" each chapter has great programming challenges to make sure you understand and can apply the theory. Also it explains everything in great detail.
Update: Also Java looks a lot C++ and thus also C#. If you look at the most popular languages the C derivatives are most popular. Learning Java will make it easier to switch to other languages.
Start with Python, without any doubt.
Python can make huge difference for beginner. I remember that child of one of my friend spent few weeks in a summer camp learning Java or C++, and got really confused and not sure anymore he wants to study computers. I started Python interpreter and shown him how easy things can be, and I remember the smile on his face which explained everything.
Python is much easier to start with, for several reasons:
Java objects are often they are confusing: in example, there are multiple integer types: Integer
(which is object), and int
, which is not. I've seen the confusion it caused to beginners first-hand, and few more, with different precision (how many digits they can hold). Using wrong type in Java will cause compile-time or worse runtime error. Python has just one integer type, and will convert internally to whatever precision you need. Same with array size: If your data increased and will not fit, Java will have runtime error, Python will double the array size.
Python is excellent also for many tasks for which Java is not a good fit: small little programs to manipulate files, parse and analyze text files like log files, to automate system administration tasks.
Python was designed for people who are not experts in computer science/engineering, and need a language which works hard to help them to solve their problems.
Disclaimer: Obviously, there is no silver bullet. Even in Python, if you use wrong type, you will get runtime error.
It is not compulsory to learn Python or Java for Automation but it would be better to know Java concepts(or python concept if using python in Automation) and basic fundamental of language.
If you need to know and understand core of framework like selenium or testNG then you should have good knowledge of Programming language knowledge.
I'm a fan of the Udacity classes: Computer Science 101: uses (and teaches) Python basic CS concepts, while building a search engine: https://www.udacity.com/course/cs101
Software Testing: Teaches testing, by writing Python test code https://www.udacity.com/course/cs258
Nowadays, irrespective of being a developer or tester we all need to know a development language and my advice will be: either Java or Python both are doing equally good; but learning python is easier, number of lines of code in python is also very less for given functionality, maintainability of code is easier and structuring is also very simple compared to Java.
However resource availability (namely libraries, tools, end to end integration support) for Java is a little higher as Java is widely used.
Nevertheless there a is big turnaround in Python from past 4-5yrs and it's taking over the software industry and future seems to be Python as it's evidently introduced even at schooling level (in India & rest of the world I am not that sure though) and there exists no Java in there and C++ is optional. Lots of Python utilities are available to fulfill the needs of most of the technical sectors.
From jobs point of view of today there are more jobs for Selenium with Java than Selenium with Python.
Java is a really good language too, but it takes more to learn Java than Python.
Now how long you want to code is one of the important decision you need to make!
Personally I would have to recommend that you learn Ruby. Most of the BDD automation tools like Cucumber and RSpec are coming from the Ruby community and it offers a wealth of test automaton tools available.
As you are new to programming, I highly recommend that you head over to code academy and do their free online ruby training.
I would also recommend that you grab a copy of the Cucumber book and start working through it.
It depends from software development branch you want to come. But I suggest you to learn Java because this is one of the most popular language at nowadays (http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html). If you will learn Java you shall develop tests for Desktop, Web and Android. Also I suggest you to learn Python, Shell, Javascript - they are easy to learn and a lot of application may to use.
For Automation testing you have to learn programming language. Sure, first steps may be to do with play-and-records tools (like Selenium IDE or CodedUI)
But for solid framework system you should write heap code, use patterns, debaggs and storage code in CVS system (git or svn).
My opinion, the first language must be same which your developers use. They can help you and get good tips hot to use code.
For first steps in dev follow next links:
Codeacademy where you can do first steps with python, ruby and more
Good luck!
If you are going to learn it on your own (in case your company does not buy an expensive automation tool that you MUST work with) I advise you to start with basic programming language courses, preferably the same as your devs use, buy a book on it and start from the beginning
After that look at webdriver documentation and start building a framework (a set of functions that you use regularly in order to save time and make your code readable and easy to debug). I think is better to use "C# + Visual Studio + Git" or "Java + Eclipse + Git", these are the ones I know better, if your devs use python or ruby they can help you with that.
Anyway, just speaking from my own experience, no fundamental knowledge here...
The answer is yes and no.
You should have knowledge about programming to be able to adopt the situation you are in. When it is needed you should be able to learn the particular language to write automated tests. For example, selenium can be used with many languages because there are little differences in its API. So that, the point of the "pick up new stuff" situation is the programming language itself and the technology (if you are in java environment you should know what the difference between pure java and JEE) not the selenium itself.
Here is my situation. When I started working in IT I only knew php. Later I learned java and I wrote a lot of automated UI tests using Selenium in java. Later, I changed my job and I had to learn how to do this using c#. Now my girlfriend has to learn how to do the same using Ruby and she asked me to help, so that I had to learn Ruby. The more time I go through this "pick up new stuff" process the easier to pick up the necessary knowledge to do my job.
Sometimes my job was only testing not to write automated tests because it was the developers' tasks as well. So, as you can see to create automated tests it is not necessary to have programming skills because, sometimes, test automation is part of the development tasks. However, if you are able to take part not only test creation (BVA, QP, etc.) but also test automation you will be respected not only because your knowledge, but also your attitude.
The backside of the whole is that, my knowledge is superficial ( I dare say that my skills would be enough to be an experienced junior programmer, however my whole IT experience would be enough to be a senior due to the stuff I have seen so far), so I have to spend time to make it stronger. But, as a tester I'm a respected because I have skills and I learn fast.
Below is some documentation for Selenium as for each particular language it accepts:
These should help you get a start with Selenium in each language.
Here is a detailed comparison between Java and Python. It explains how Python is typically more concise than Java, which is very true. With Python you are likely to end up with far less code. This can be a huge benefit and make it far easier to learn Python.
If I had to choose between Python or Java I would likely choose Java. It just has a better future and is more likely to be what is being used by the system than Python. Also it is, in my opinion, a lot easier to learn.
If I had to choose between all languages, I would likely suggest Perl for software testing. A lot of testing has to do with verification and strings, Perl is likely the best languages for this. Also, get started with regular expression as quickly as possible, it will pay off big time. And since Regular Expression's basics transfers throughout the majority of the programming languages it will give you a huge advantage over a lot of the other testers in the market.
Ultimately it depends on what your attempting to accomplish. Do you want to be great at your job or do you want an impressive resume? I can list 9 programming languages on my resume since I dabble in a lot of them for different situations. If I need to do a lot of String parsing, I choose Perl. If I need a quick script, Python. Something more advanced, Java. And since my company seems to love ASP for all of their QA stuff, when I need to update our internal QA sites, it's usually ASP.Net.
I would suggest Python as it is very easy to learn. If you are going to use Selenium webdriver then you can go through the documentation and sample code at http://docs.seleniumhq.org/
It all depends on your project requirements and tools to be used. To start with automation testing you don't necessarily need to master any language upfront.
Of course, knowing a programming language what your tool is going to be used or designed is helpful. It's better to start with understanding the concepts and framework for automation.
For selenium webdriver,as all said, one can start with basic Java skills. For the question of Python vs Java, a few factors play a role
On the other hand, it's always complementing to have scripting skills. For QA, Perl, Python, VBScripting etc are a few of the useful skills.
Do not tie yourself to a language. Learn the fundamentals of good programming design. Learn when to use a conditional loop, or when to make a function of inline code.
I never know what language I am going to be expected to work in, but I know the fundamentals of OOP and test design. Start with pseudo coding and just work out the "How" you will accomplish the task. Answering the question of "What" language to implement or what tool to select can come later.
Though it's not mandatory but as a new programmer, Python and Ruby are the better choices to start. From my personal experiences, their learning curves are steeper and very interesting which will make your automation expedition really enjoyable.
It is very important in test automation to start with your language means you comfort zone and my advice will be: either Java or Python both are doing equally good, but learning python is easier than Java, number of lines of code in python is also very less for given functionality as compared to java.
However, resource availability (namely libraries, tools and end to end integration support) for Java is a little higher, as Java is widely used.
Nevertheless there a is big turnaround in Python from past 4-5 yrs and it's taking over the software industry and future seems to be Python as it's evidently introduced even at schooling level (in India & rest of the world I am not that sure though) and there exists no Java in there and C++ is optional. Lots of Python utilities are available to fulfill the needs of most of the technology sectors.
Although Python is considered an easier language to learn by many, that shouldn't be the overriding factor to consider. I would start with Java as I would argue it provides a better introduction to programming fundamentals than Python, which might be useful if you decide to change to another language like C# or C++ in the future.