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.

Questions and Answers

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?

A - Assert

B - TestCase

C - TestResult

D - TestSuite

Answer : B

Explanation

TestCase contains a test case and defines the fixture to run multiple tests.

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.

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?

A - void showResult(Test test)

B - void getResult(Test test)

C - void endTest(Test test)

D - void startTest(Test test)

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?

A - int testCount()

B - int runCount()

C - int countExecutions()

D - int countRun()

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.

A - true

B - false

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?

A - JUnitCore

B - TestCase

C - TestSuite

D - TestResult

Answer : C

Explanation

Test suite means bundle a few unit test cases and run it together.

Q 9 - JUnit is a proprietory framework.

A - true

B - false

Answer : B

Explanation

JUnit is an open source framework.

Q 10 - Eclipse supports JUnit integration using its plugin.

A - true

B - false

Answer : A

Explanation

Eclipse supports JUnit integration using its JUnit plugin.

junit_questions_answers.htm
Advertisements