- 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 - Which of the following is correct about Fixture?
A - Fixture includes setUp() method which runs before every test invocation.
B - Fixture includes tearDown() method which runs after every test method.
Answer : C
Explanation
Fixture includes setUp() method which runs before every test invocation and tearDown() method which runs after every test method.
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 that a condition is true?
A - void assert(boolean condition)
B - void assertTrue(boolean condition)
Answer : B
Explanation
void assertTrue(boolean condition) checks that a condition is true.
Q 5 - Which of the following method of TestCase class tears down the fixture, for example, close a network connection?
Answer : B
Explanation
void tearDown() method tears down the fixture.
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 - 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 - Which of the following class is used to bundle unit test cases and run them together?
Answer : C
Explanation
Test suite means bundle a few unit test cases and run it together.
Answer : B
Explanation
JUnit is an open source framework.
Answer : A
Explanation
Assert contains a set of assert methods.