JUnit Online Quiz


Advertisements


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 : B

Explanation

Unit testing is the testing of single entity (class or method).

Q 2 - Which of the following class contains methods to collect the results of executing a test case?

A - Assert

B - TestCase

C - TestResult

D - TestSuite

Answer : C

Explanation

TestResult class contains methods to collect the results of executing a test case.

Q 4 - Which of the following method of Assert class fails a test with no message?

A - void assertChecks(boolean pass)

B - void assertCheck(boolean pass)

C - void assert(boolean pass)

D - void fail()

Answer : D

Explanation

void fail() fails a test with no message.

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.

Answer : A

Explanation

void run(TestCase test) method runs a TestCase.

Q 7 - Which of the following method of TestSuite class returns the number of tests in this suite?

A - int testCount()

B - int testCaseCount()

C - int getTestCount()

D - int testSuiteCount()

Answer : A

Explanation

int testCount() method returns the number of tests in this suite.

Q 8 - If a test class is annotated with @Ignore then none of its test methods will be executed.

A - false

B - true

Answer : B

Explanation

If a test class is annotated with @Ignore then none of its test methods will be executed.

Q 9 - Testing is the process of checking the functionality of the application whether it is working as per requirements.

A - true

B - false

Answer : A

Explanation

Testing is the process of checking the functionality of the application whether it is working as per requirements.

Q 10 - Assert contains a set of assert methods.

A - true

B - false

Answer : A

Explanation

Assert contains a set of assert methods.


junit_questions_answers.htm

Advertisements
E-Books Store