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.

What is JUnit?

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.

What is a test suite?

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.

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.