
- JUnit Tutorial
- 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 Useful Resources
- JUnit - Questions and Answers
- JUnit - Quick Guide
- JUnit - Useful Resources
- JUnit - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 JUnit?
Answer : C
Explanation
JUnit provides Test runners for running tests. JUnit tests can be run automatically and they check their own results and provide immediate feedback.
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 class is a Composite of Tests?
Answer : D
Explanation
TestSuite class is a Composite of Tests.
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 runs a test, collecting the results with a default TestResult object?
Answer : D
Explanation
TestResult run() method runs a test, collecting the results with a default TestResult object.
Q 6 - Which of the following method of TestResult class runs a TestCase?
B - void execute(TestCase test)
Answer : A
Explanation
void run(TestCase test) method runs a TestCase.
Q 7 - Which of the following method of TestSuite class returns the name of the suite?
Answer : C
Explanation
String getName() method returns the name of the suite.
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 : B
Explanation
JUnit is an open source framework.
Answer : B
Explanation
Fixture includes setUp() method which runs before every test invocation.