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

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.

Answer : C

Explanation

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

Answer : C

Explanation

void assertNotNull(Object object) checks that an object isn't null.

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 TestResult class gets the number of detected failures?

A - int error()

B - int errorCount()

C - int failureCount()

D - int failure()

Answer : C

Explanation

int failureCount() method gets the number of detected failures.

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 - @RunWith and @Suite annotation are used to run the suite test.

A - false

B - true

Answer : B

Explanation

Both @RunWith and @Suite annotation are used to run the suite test.

Q 9 - JUnit provides Assertions for testing expected results.

A - true

B - false

Answer : A

Explanation

JUnit provides Assertions for testing expected results.

Q 10 - Unit Tests are written after the code during development in order to help coders test the code.

A - true

B - false

Answer : B

Explanation

Unit Tests are to be written before the code during development in order to help coders write the best code.


junit_questions_answers.htm

Advertisements