What is the difference between libraries and Framework
Let's see through an example
Library and framework both are dependent on the rule .. consider library is your home and framework is your university. when you have less number of rules , it is more likely to be your library AND
when you have more number of rules , it is higher chances to be your framework .
In home ,you can throw shirt wherever you like ,you can place your bag wherever you like !!
But in University , there are fixed places to keep bag ,where you are going to sit ,markers has fix place(mostly near to teacher).Here ,there are more options for marker but it will more likely to be closer to teacher .That means you are bounded to more rules .
On the other hand , at home there are less number of rules .YES, you may like to follow rules at home but mostly those are built by you!
Let's imagine with another example that you had opened a burger restaurant in your city a while ago. But you feel it's so hard to make a burger as a beginner. You were thinking about an easy way to make burgers for customers. Someone told you that If you use framework, you can make burger easily and you got to know that there are McDonald Burger Framework and BurgerKing Burger Framework.
If you use McDonald Burger Framework, It's so easy to make Big Mac burger. (but you cannot make Whopper.)
If you use BurgerKing Burger Framework, It's so easy to make Whopper Burger. (however, you cannot make Big Mac)
Anyway, In the end, they are all burgers. An important thing here is, you have to follow their framework's rule to make burgers. otherwise, you feel even harder to make it or won't be able to make it.
And you also heard that there is something called Simple Burger-Patty Library.
If you use this Library, you can make whatever burger patty so easily (X2 speed). It doesn't really matter if you use McDonald Burger Framework or BurgerKing Burger Framework. Either way, you can still use this Simple Burger-Patty Library. (Even you can use this Library without frameworks.)
Library is collection of code that was previously written that can be called upon when building on your code. Meaning ,You have the power to call the code whenever you like , it is called as library .Reusability is the main advantage.
On the other hand ,In Framework , framework calls the code and code calls the library (if needed).
Java libraries:Java is one of the most popular programming languages. Java provides a rich set of libraries, and its standard Java library is a very powerful that contains libraries such as java.lang, java.util, and java.math, etc. Java provides more than thousands of libraries except standard libraries. Some of the most useful and popular libraries are as follows:
Java Standard libraries
Log5j and Slf4j
Automation Framework : Each automation framework has its own architecture, advantages, and disadvantages. Some of these frameworks are:
Linear Automation Framework
Modular Driven Framework
Behavior Driven framework
Hybrid Testing Framework
Do you see the difference between Framework vs Library now?