- 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
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 runs test cases significantly faster than human resources.
Answer : C
Explanation
Automation runs test cases significantly faster than human resources. Test cases are executed by using automation tool so less tester are required in automation testing.
Q 2 - Which of the following class contains a test case and defines the fixture to run multiple tests?
Answer : B
Explanation
TestCase contains a test case and defines the fixture to run multiple tests.
Q 3 - Which of the following is correct about JUnit execution procedure?
A - Method annotated as @After executes for each test case but after the execution of test case.
B - In between method annotated as @Before and method annotated as @After each test case executes.
Answer : C
Explanation
Method annotated as @After executes for each test case but after the execution of test case. In between method annotated as @Before and method annotated as @After each test case executes.
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 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 TestResult class gets the number of run tests?
Answer : B
Explanation
int runCount() method gets the number of run tests.
Q 7 - The @Test 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 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
Eclipse supports JUnit integration using its JUnit plugin.
To Continue Learning Please Login
Login with Google