JUnit Online Quiz
Following quiz provides Multiple Choice Questions (MCQs) related to JUnit Framework. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Q 1 - Which of the following is correct about manual testing?
B - No programming can be done to write sophisticated tests which fetch hidden information.
Answer : C
Explanation
Manual testing is less reliable as tests may not be performed with precision each time because of human errors. No programming can be done to write sophisticated tests which fetch hidden information.
Q 2 - Which of the following class contains methods to collect the results of executing a test case?
Answer : C
Explanation
TestResult class contains methods to collect the results of executing a test case.
Q 3 - Which of the following annotation causes that method run once before any of the test methods in the class?
Answer : C
Explanation
Annotating a public static void method with @BeforeClass causes it to be run once before any of the test methods in the class.
Q 4 - Which of the following method of Assert class checks that two primitives/Objects are equal?
A - void assertEquals(boolean expected, boolean actual)
B - void assert(boolean expected, boolean actual)
Answer : A
Explanation
void assertEquals(boolean expected, boolean actual) checks that two primitives/Objects are equal.
Q 5 - Which of the following method of TestResult class informs the result that a test was completed?
Answer : C
Explanation
void endTest(Test test) method informs the result that a test was completed.
Q 6 - Which of the following method of TestResult class informs the result that a test will be started?
Answer : A
Explanation
void startTest(Test test) method informs the result that a test will be started.
Q 7 - Annotating a public void method with @BeforeClass causes that method to be run before each Test method.
Answer : A
Explanation
Annotating a public static void method with @BeforeClass causes it to be run once before any of the test methods in the class.
Q 8 - Annotating a public void method with @AfterClass causes that method to be run after each Test method.
Answer : A
Explanation
@AfterClass will perform the method after all tests have finished. This can be used to perform clean-up activities.
Answer : A
Explanation
Automation runs test cases significantly faster than human resources.
Q 10 - TestCase contains a test case and defines the fixture to run multiple tests.
Answer : A
Explanation
TestCase contains a test case and defines the fixture to run multiple tests.