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

Since test cases are executed by human resources so it is very slow and tedious and as test cases need to be executed manually so more testers are required in manual testing.

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.

Q 3 - Which of the following annotation causes that method to be run before each Test method?

A - @Test

B - @Before

C - @After

D - @BeforeClass

Answer : B

Explanation

Annotating a public void method with @Before causes that method to be run before each Test method.

Answer : C

Explanation

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

Q 5 - Which of the following method of TestCase class gets the name of a TestCase?

A - String getTestName()

B - String getNameOfTest()

C - String getName()

D - String getTestCase()

Answer : C

Explanation

String getName() method gets the name of a TestCase.

Answer : A

Explanation

void run(TestCase test) method runs a TestCase.

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