Saturday, 24 October 2015

SELENIUM FRAME WORKS

SELENIUM FRAMEWORK
A test automation framework is a set of concepts, and practices that provide support for automated software testing. It is a methodology built to successfully carry out test automation. If we do not have any frameworks, then it is difficult to get proper reports, handle checkpoints, or exception handling.
Now either you may choose from any of the frameworks available like JUnit & TestNG or you can design our own framework.
Junit is a unit testing framework or the Java programming language. TestNG is specially designed to cover all types testing categories like Unit, Functional testing, Integration testing, End-to-end etc. 
TestNG is a preferred framework of QA analysts as it allows you to generate test reports in both HTML and XML formats. TestNG enable you to group test cases easily which is not possible in JUnit.  
JUnit and TestNG are both very popular unit test framework in Java. Both frameworks look very similar in functionality. Which one is better? Which unit test framework should I use in Java project?
Here I did a feature comparison between JUnit  and TestNG
DIFFERENCES BETWEEN JUNIT AND TESTNG
Feature
Junit
TestNG
test annotation
@test
@test
run before all tests in this suite have run
@beforeclass
@beforeclass
run after all tests in this suite have run
@afterclass
@afterclass
run before each test method
@before
@beforemethod
run after each test method
@after
@aftermethod
ignore test
@ignore
(Enabled=false)
results
Not clear
Results very clear
run
We can’t run priority base
We can run priority base
@beforeclass,@afterclass
Should be static
No need
status
Old frame work
New framework
installation
We need to install
No need to install

JUnit: it is software which provides some facilities through annotations which make the testing job easier as it is making some (testing) job more easy people generally call it as JUnit Framework.
Configuring JUnit into eclipse:
Right click on project select Properties.
Click on Java Build Path
Click on Add Library
Click on JUnit then click on Next
From the drop down list box select JUnit4
Click in finish.
Note: if the project is newly created then configure the selenium web driver also to your project, the process of configuring selenium is mentioned in the above pages.
Note:
 We no need to have main() method in our class because JUnit is going to take care about it.
It is old and famous framework having more no of annotations.
Order of Execution is based on the annotations but not in the order in which we have written the code
TestNG(Next Generation): it is software which provides some facilities through annotations which make the testing job easier as it is making some(testing) job more easy people generally call it as TestNG Framework.
Navigation for downloading and installing TestNG into eclipse:
Type install TestNG click on search
Click on first URL then copy the url “for eclipse 3.4 and above”
Open eclipse then click on help menu item
Select the option Install New Software
Paste the URL at Work With field then select the checkbox TestNG .
Click on next….next
Click on finish.
Note: after pasting the URL if you are not getting TestNG then follow the below steps
Click on Add then in the Name field type TestNG and in the location field paste the URL then click on Ok.
Now TestNG check box is available then click on next…next
Click on finish.
Configuring the TestNG into eclipse:
Right click on project select Properties.
Click on Java Build Path
Click on Add Library
Click on TestNG then click on Next
Click in finish.
Note: if the project is newly created then configure the selenium web driver also to your project, the process of configuring selenium is mentioned in the above pages.

No comments:

Post a Comment