Javatpoint Logo

91-9990449935

 0120-4256464

JUnit Interview Question

A list of top frequently asked JUnit interview questions and answers are given below.


1) What is Testing?

Testing is the process of checking the functionality of the application whether it fulfills the requirement or not.


2) What is JUnit?

JUnit is the testing framework, it is used for unit testing of java code.

More details...

3) What is unit testing?

The process of testing individual functionality (known as unit) of the application is called unit testing.


4) What is the difference between manual testing and automated testing?

Manual testing is performed by human so it is time consuming and costly. Automated testing is performed by testing tools or programs so it is fast and less costly.

More details...

5) It is necessary to write the test case for every logic?

No, we should write the test case only for those logic that can be reasonably broken.


6) What are the useful JUnit extensions?

  • JWebUnit
  • XMLUnit
  • Cactus
  • MockObject

7) What are the features of JUnit?

  • Opensource
  • Annotation support for test cases
  • Assertion support for checking the expected result
  • Test runner support to execute the test case

8) What is Unit Test Case?

A Unit Test Case is the combination of input data and expected output result. It is defined to test the functionality of an unit.


9) What is the use of @Test annotation?

The @Test annotation is used to mark the method as test method.


10) What is test suit?

The test suit allows us to group multiple test cases so that it can be run together. TestSuit is the container class under junit.framework.TestSuite package.


11) What does test runner?

The test runner is used to execute the test cases.


12) What are the important JUnit annotations?

The test runner is used to execute the test cases.

  • @Test
  • @BeforeClass
  • @Before
  • @After
  • @AfterClass

13) What does Assert class?

Assert class provides methods to test the test cases.