- 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 manual testing?
A - Since test cases are executed by human resources so it is very slow and tedious.
B - As test cases need to be executed manually so more testers are required in manual testing.
Answer : C
Explanation
Since test cases are executed by human resources so it is very slow and tedious and as test cases need to be executed manually so more testers are required in manual testing.
Q 2 - When should Unit Tests be written in Development Cycle?
B - Unit Tests are written after the code during development in order to help coders test the code.
Answer : A
Explanation
Unit Tests are to be written before the code during development in order to help coders write the best code.
Q 3 - Which of the following is correct about org.junit.JUnitCore class?
A - The test cases are executed using JUnitCore class.
B - JUnitCore is a facade for running tests.
C - It supports running JUnit 4 tests, JUnit 3.8.x tests, and mixtures.
Answer : D
Explanation
The test cases are executed using JUnitCore class. JUnitCore is a facade for running tests. It supports running JUnit 4 tests, JUnit 3.8.x tests, and mixtures.
Q 4 - Which of the following method of Assert class checks if two object references point to the same object?
A - void assert(Object expected, Object actual)
B - void assertCheck(Object expected, Object actual)
Answer : C
Explanation
void assertSame(Object expected, Object actual) checks if two object references point to the same object.
Q 5 - Which of the following method of TestCase class sets up the fixture, for example, open a network connection?
Answer : B
Explanation
void setUp() method sets up the fixture.
Q 6 - Which of the following method of TestSuite class counts the number of test cases that will be run by this test?
Answer : D
Explanation
int countTestCases() method counts the number of test cases that will be run by this test.
Q 7 - Which of the following method of TestSuite class runs the tests and collects their result in a TestResult?
A - void execute(TestResult result)
B - void runTest(TestResult result)
Answer : C
Explanation
void run(TestResult result) method runs the tests and collects their result in a TestResult.
Answer : B
Explanation
Both @RunWith and @Suite annotation are used to run the suite test.
Answer : A
Explanation
JUnit provides Assertions for testing expected results.
Q 10 - JUnit tests can be run automatically and they check their own results and provide immediate feedback.
Answer : A
Explanation
JUnit tests can be run automatically and they check their own results and provide immediate feedback.