- 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 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 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 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 Assert class checks that a condition is false?
A - void assert(boolean condition)
B - void assertFalse(boolean condition)
Answer : B
Explanation
void assertFalse(boolean condition) checks that a condition is false.
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 informs the result that a test will be started?
Answer : A
Explanation
void startTest(Test test) method informs the result that a test will be started.
Q 7 - Annotating a public void method with @After causes that method to be run after each Test method.
Answer : B
Explanation
Annotating a public void method with @After causes that method to be run after each Test method.
Q 8 - @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 9 - 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
Fixture includes setUp() method which runs before every test invocation.