- 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 describes Unit Testing correctly?
B - Unit testing is the testing of single entity (class or method).
Answer : B
Explanation
Unit testing is the testing of single entity (class or method).
Q 2 - Which of the following is correct about a Unit Test Case?
Answer : C
Explanation
There must be at least two unit test cases for each requirement: one positive test and one negative test. If a requirement has sub-requirements, each sub-requirement must have at least two test cases as positive and negative.
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 checks that an object isn't null?
A - void assert(Object object, boolean toCheckAsNull)
B - void assertCheck(Object object, boolean toCheckAsNull)
Answer : C
Explanation
void assertNotNull(Object object) checks that an object isn't null.
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 TestSuite class adds a test to the suite?
Answer : C
Explanation
void addTest(Test test) method adds a test 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.
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.