
- 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 Mock Test
This section presents you various set of Mock Tests related to JUnit Framework. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

JUnit Mock Test IV
Answer : B
Explanation
Both @RunWith and @Suite annotation are used to run the suite test.
Answer : B
Explanation
A test method annotated with @Ignore will not be executed.
Q 3 - If a test class is annotated with @Ignore then none of its test methods will be executed.
Answer : B
Explanation
If a test class is annotated with @Ignore then none of its test methods will be executed.
Q 4 - @Test annotation along with timeout attribute can be used to set timeout of a test case.
Answer : B
Explanation
@Test annotation along with timeout attribute can be used to set timeout of a test case.
Q 5 - @Test annotation along with expected attribute can be used to test the code whether code throws desired exception or not.
Answer : A
Explanation
@Test annotation along with expected attribute can be used to test the code whether code throws desired exception or not.
Q 6 - Parameterized tests allow developer to run the same test over and over again using same values.
Answer : B
Explanation
Parameterized tests allow developer to run the same test over and over again using different values.
Q 7 - Annotate test class with @RunWith(Parameterized.class) to create a parameterized test case.
Answer : A
Explanation
Annotate test class with @RunWith(Parameterized.class) to create a parameterized test case.
Q 8 - Testing is the process of checking the functionality of the application whether it is working as per requirements.
Answer : A
Explanation
Testing is the process of checking the functionality of the application whether it is working as per requirements.
Answer : B
Explanation
Unit Testing is the testing of single entity (class or method). Testing is the process of checking the functionality of the application whether it is working as per requirements.
Answer : A
Explanation
Automation runs test cases significantly faster than human resources.
Q 11 - Automated Test cases are executed by using automation tool so less tester are required in automation testing.
Answer : A
Explanation
Automated Test cases are executed by using automation tool so less tester are required in automation testing.
Answer : B
Explanation
JUnit is an open source framework.
Answer : A
Explanation
JUnit 4.0 provides Annotations to identify the test methods.
Answer : A
Explanation
JUnit provides Assertions for testing expected results.
Answer : A
Explanation
JUnit provides Test runners for running tests.
Q 16 - 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.
Q 17 - Unit Tests are to be written before the code during development in order to help coders write the best 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 18 - Unit Tests are written after the code during development in order to help coders test the code.
Answer : B
Explanation
Unit Tests are to be written before the code during development in order to help coders write the best code.
Answer : A
Explanation
Eclipse supports JUnit integration using its JUnit plugin.
Answer : A
Explanation
Fixture includes setUp() method which runs before every test invocation.
Answer : B
Explanation
Fixture includes setUp() method which runs before every test invocation.
Answer : A
Explanation
Fixture includes tearDown() method which runs after every test method.
Q 23 - Fixture includes tearDown() method which runs after all test methods get executed.
Answer : B
Explanation
Fixture includes tearDown() method which runs after every test method.
Answer : A
Explanation
Assert contains a set of assert methods.
Q 25 - 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.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | B |
2 | B |
3 | B |
4 | B |
5 | A |
6 | B |
7 | A |
8 | A |
9 | B |
10 | A |
11 | A |
12 | B |
13 | A |
14 | A |
15 | A |
16 | A |
17 | A |
18 | B |
19 | A |
20 | A |
21 | B |
22 | A |
23 | B |
24 | A |
25 | A |