JUnit Interview Questions and Answers

What is Testing?

Testing is the process of checking an application that it is working as expected. Working as expected means for a known input it must give the expected output. In other words testing is a process of verification and validation.
See more at: Junit overview.

What is Unit testing?

Unit testing is the testing of an individual unit (class/method) or group of related units.
See more at: Junit overview.

What is Manual testing?

Manual testing is the process of executing a test case without any tool support.
See more at: Junit overview.

What is Automated testing?

Automated testing is the process of executing a test case with any tool support.
See more at: Junit overview.

What is JUnit?

JUnit is an open-source unit testing framework for java programmers. It is only used for unit testing. Integration testing is done by TestNG.
See more at: Junit overview.

What is a Unit Test Case?

Unit test case is part of code which executes to check that another part of the code works as expected.
Note: We have to write two test cases for every requirement/sub-requirement one positive and one negative.
See more at: Junit overview.

What is a test suite?

The suite test refers to group a few unit test cases and run it together. The @RunWith and @Suite annotation are used to run the suite test.
See more at: JUnit suite test.

What is JUnit expected exception test?

Expected exception test is used for the methods which can throw an exception. We have to specify expected exception in @Test(expected = expectedException.class) action. If expected exception or any of its subclass exception is thrown by the method then JUnit will pass this unit test.

What is Junit ignore test?

The @Ignore annotation is used to ignore test cases. The @Ignore annotation can be used with method or class. If it is used with the method then that method will be ignored by JUnit and will not execute and if it is used with the class then all methods of that class will be ignored and no method will execute.
See more at: Junit ignore test.

What is JUnit time test?

The time test is used to check that if a test case is completed within the specified time or not. JUnit terminate and mark it failed automatically if it takes more time than the specified milliseconds. We have to specify time in milliseconds in @Test(timeout = timeInMilliSeconds) action.
See more at: JUnit time test.

What is JUnit parameterized test?

The parameterized test is a new feature introduced in JUnit 4. It provides the facility to execute the same test case again and again with different values.

What is Junit test runner?

Test runner is used for executing the test cases.
See more at: Junit test runner.

No comments: