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

Explanation

Manual testing is less reliable as tests may not be performed with precision each time because of human errors. No programming can be done to write sophisticated tests which fetch hidden information.

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

void assertNull(Object object) checks that an object is null.

Answer : B

Explanation

void addFailure(Test test, AssertionFailedError t) method adds a failure to the list of failures.

Q 6 - Which of the following method of TestSuite class counts the number of test cases that will be run by this test?

A - int countTestExecutions()

B - int countTest()

C - int count()

D - int countTestCases()

Answer : D

Explanation

int countTestCases() method counts the number of test cases that will be run by this test.

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 - A test method annotated with @Ignore will not be executed.

A - false

B - true

Answer : B

Explanation

A test method annotated with @Ignore will not be executed.

Q 9 - JUnit 4.0 provides Annotations to identify the test methods.

A - true

B - false

Answer : A

Explanation

JUnit 4.0 provides Annotations to identify the test methods.

Q 10 - Fixture includes setUp() method which runs once when test class loads.

A - true

B - false

Answer : B

Explanation

Fixture includes setUp() method which runs before every test invocation.


junit_questions_answers.htm

Advertisements