- 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 automated testing?
A - Automation tests perform precisely same operation each time they are run.
B - Testers can program sophisticated tests to bring out hidden information.
Answer : C
Explanation
Automation tests perform precisely same operation each time they are run. Testers can program sophisticated tests to bring out hidden information.
Q 2 - Which of the following tools provides JUnit integration?
Answer : D
Explanation
All of the above tools provides JUnit integration.
Q 3 - Which of the following annotation causes that method run once after all tests have finished?
Answer : D
Explanation
Annotating a public static void method with @AfterClass cause that method run after all tests have finished. This can be used to perform clean-up activities.
Q 4 - Which of the following method of TestCase class counts the number of test cases executed by run(TestResult result)?
Answer : A
Explanation
int countTestCases() method counts the number of test cases executed by run(TestResult result).
Q 5 - Which of the following method of TestResult class adds an error to the list of errors?
A - void addError(Test test, Throwable t)
B - void addError(Test test, Error t)
Answer : A
Explanation
void addError(Test test, Throwable t) method adds an error to the list of errors.
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 a test which will fail and log a warning message?
A - static Test displayWarning(String message)
B - static Test showWarning(String message)
Answer : D
Explanation
int testCount() method returns a test which will fail and log a warning message.
Q 8 - The @Ignore annotation is used to ignore the test and that test will not be executed.
Answer : B
Explanation
The @Ignore annotation is used to ignore the test and that test will not be executed.
Answer : B
Explanation
JUnit is an open source framework.
Answer : A
Explanation
Fixture includes setUp() method which runs before every test invocation.