How much java is required to start with Selenium Automation Testing?
My experience is, that the basics of Java is enough to start developing test cases with Selenium WebDriver. Myself started developing of Selenium test cases with a very basic knowledge about Java. The more test cases I wrote and solutions I had to find, the more I leaned Java.
The level of Java knowledge depends on what you want to do with Selenium.
So, With having very little knowledge of Java, you can start writing test cases using selenium WebDriver, but in order to master it, you should go with Step By Step improvement, like –
Suppose, Step1:
You may just want to write some simple test automation scripts in which case basic Java knowledge is sufficient. To start basic selenium tests, one should know at-least –
• Java Programming Language Keywords
• Data Types
• Variables
• Modifiers – Access Modifiers
• Modifiers – Non-Access Modifiers
• Operators
• Conditional Operators
• Decision Making (If…Else, Switch case, For Loop, While Loop, Break Loops)
• Functions
• Try…Catch
• Arrays
• exceptions
• Read & Write files (FileInputStream and FileOutStream)
Step2:
Now, as soon as you are able to write basic selenium scripts, start having more and more script, because you should know how to maintain them as well.
If you want to make your test automation code re-usable, then object oriented programming concepts are important.
So, Now, lets make the test automation code more re-usable.
The basic OOPs concepts states more about code re-usability. For these purposes, you need to start learning the Java object oriented programming concepts.
This includes learning about
• Class and Object
• Data Types
• Methods of String class
• Array Declaration, Construction and Initialization
• Encapsulation
• Polymorphism
• Inheritance
• File IO
• Collections
The object-oriented programming concepts will help implementing the page object model for your test automation scripts.
By doing this, you keep your test scripts free of any direct interaction with the site.
Step3:
Now, you are good, able to create Selenium test scripts using re-usable code. After this, next step would be to understand the proper framework structure and follow that.
If you want to create a framework, then learn advanced Java concepts like polymorphism, abstract classes, interfaces, etc.
After having page object classes, you will want to start creating your test automation framework.
You need to learn the Java advanced concepts like
• Java Collection Framework
• List, Map and Set
• Java File Operations (using apache POI or Jexcel), ExceptionHandling,
• logger would be plus point.
• Junit or TestNG to start with unit testing so you can assert your test cases.
It’s important to follow the sequence in which you will be learning the above topics. This makes a lot of difference. Some of the conceptual topics in Java can really be confusing, if not learnt with the correct approach. This is one of the reasons, why many leave it mid-way.