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

JUnit tests can be organized into test suites containing test cases and even other test suites. JUnit shows test progress in a bar that is green if test is going fine and it turns red when a test fails in eclipse.

Answer : C

Explanation

Test suite means bundle a few unit test cases and run it together. In JUnit, both @RunWith and @Suite annotation are used to run the suite test.

Answer : D

Explanation

The test cases are executed using JUnitCore class. JUnitCore is a facade for running tests. It supports running JUnit 4 tests, JUnit 3.8.x tests, and mixtures.

Answer : B

Explanation

void assertFalse(boolean condition) checks that a condition is false.

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 TestSuite class adds a test to the suite?

A - void add(Test)

B - void add()

C - void addTest(Test test)

D - void addTestCase(Test test)

Answer : C

Explanation

void addTest(Test test) method adds a test to the suite.

Q 7 - Annotating a public void method with @BeforeClass causes that method to be run before each Test method.

A - false

B - true

Answer : A

Explanation

Annotating a public static void method with @BeforeClass causes it to be run once before any of the test methods in the class.

Q 8 - The @Ignore annotation is used to ignore the test and that test will not be executed.

A - false

B - true

Answer : B

Explanation

The @Ignore annotation is used to ignore the test and that test will not be executed.

Q 9 - Automated Test cases are executed by using automation tool so less tester are required in automation testing.

A - true

B - false

Answer : A

Explanation

Automated Test cases are executed by using automation tool so less tester are required in automation testing.

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