- JUnit - Home
- JUnit - Overview
- JUnit - Environment Setup
- JUnit - Test Framework
- JUnit - Basic Usage
- JUnit - API
- JUnit - Writing a Tests
- JUnit - Using Assertion
- JUnit - Execution Procedure
- JUnit - Executing Tests
- JUnit - Suite Test
- JUnit - Ignore Test
- JUnit - Time Test
- JUnit - Exceptions Test
- JUnit - Parameterized Test
- JUnit - Plug with Ant
- JUnit - Plug with Eclipse
- JUnit - Extensions
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 automated testing?
A - Automation tests perform precisely same operation each time they are run.
B - Testers can program sophisticated tests to bring out hidden information.
Answer : C
Explanation
Automation tests perform precisely same operation each time they are run. Testers can program sophisticated tests to bring out hidden information.
Q 2 - Which of the following is correct about Test Runner in JUnit?
A - Test runner is used for executing the test cases.
B - @RunWith and @Suite annotation are used to run the test runner.
Answer : A
Explanation
Test runner is used for executing the test cases.
Q 3 - Which of the following annotation tells JUnit that the public void method to which it is attached can be run as a test case?
Answer : A
Explanation
The @Test annotation tells JUnit that the public void method to which it is attached can be run as a test case.
Q 4 - Which of the following method of Assert class fails a test with no message?
A - void assertChecks(boolean pass)
Answer : D
Explanation
void fail() fails a test with no message.
Q 5 - Which of the following method of TestCase class sets the name of a TestCase?
Answer : C
Explanation
void setName() method sets the name of a TestCase.
Q 6 - Which of the following method of TestSuite class adds the tests from the given class to the suite?
A - void addTest(Class<? extends TestCase> testClass)
B - void addTestSuite(Class<? extends TestCase> testClass)
Answer : B
Explanation
void addTestSuite(Class<? extends TestCase> testClass) method adds the tests from the given class to the suite.
Q 7 - Which of the following method of TestSuite class returns the test at the given index?
Answer : A
Explanation
Test testAt(int index) method returns the test at the given index.
Answer : B
Explanation
Both @RunWith and @Suite annotation are used to run the suite test.
Answer : A
Explanation
JUnit 4.0 provides Annotations to identify the test methods.
Answer : A
Explanation
Assert contains a set of assert methods.