JUnit is a unit testing framework for the Java programming language. JUnit has been important in the development of test-driven development, and is one of a family of unit testing frameworks collectively known as xUnit that originated with SUnit.
JUnit is a unit testing framework which mostly used for unit testing of Java projects. JUnit4 is the enhanced version of JUnit 3 and comes with annotations such as @Before, @After, @Test, @AfterClass, @BeforeClass, etc. JUnit4 can be utilized with Selenium 2.0 WebDriver or Selenium 1.x for Test Automation of web applications.
Now, the question is what if we create our own framework instead of using JUnit Testing Framework for test automation. There are some pros and cons with this approach.
We can define our own,
Java (Any coding language) coding effort
Maintenance is difficult as getting testing resources with Java knowledge will be difficult (Resources with Java experience may not be interested in Automation Testing)
Using JUnit testing framework with Selenium 1.x / Selenium 2.0 WebDriver
Very good reporting structure is available
Can generate XML, HTML reports
There are options available to create test methods, test suites, etc
Utilize Selenium IDE or Firebug / Firepath to record test scripts
We will not be able to define our own reporting format