Home / CSE MCQs / JUnit MCQs :: JUnit Exploring Core JUnit MCQs

CSE MCQs :: JUnit MCQs

  1. The Suite object is a _____ that executes all of the @Test annotated methods in the test class.
  2. A.
    Result
    B.
    FolderConfigurationTest
    C.
    FileConfigurationTest
    D.
    Runner

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. JUnit Suites are independent of the capability of the ______ system.
  4. A.
    Run
    B.
    Class
    C.
    Test
    D.
    Build

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. What are fixtures in JUnit?
  6. A.
    Objects that specify when to run a test
    B.
    Fixed state of a set of objects used as a baseline for running tests
    C.
    Bundle of few test cases run together
    D.
    Date objects

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. What is the purpose of assertArrayEquals("message, A, B)?
  8. A.
    Checks that message" is in both A and B
    B.
    Checks that message" is in A but not B
    C.
    Checks that message" is in B but not A
    D.
    Asserts the equality of the A and B arrays

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. JUnit test files are written in files with which file extension?
  10. A.
    .junit
    B.
    .test
    C.
    .java
    D.
    .unit

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. What type of object is returned on completion of a test?
  12. A.
    org.junit.runner.Result
    B.
    org.junit.runner.Complete
    C.
    org.junit.runner.Outcome
    D.
    org.junit.runner.Object

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. To listen to events during a test, which class has to be extended?
  14. A.
    org.junit.runner.notification.RunListener
    B.
    org.junit.runner.Listener
    C.
    org.junit.runner.notification.Listener
    D.
    org.junit.runner.RunListener

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. To run the file TestClass.class from the command line, we have to type what?
  16. A.
    java TestClass
    B.
    javac TestClass
    C.
    java org.junit.runner.JUnitCore TestClass
    D.
    org.junit.runner.JUnitCore TestClass

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. When is the tearDown() method called in JUnit?
  18. A.
    After all the tests have run
    B.
    At the beginning of every test case
    C.
    After each test case has run
    D.
    At the beginning of the first test case

    View Answer

    Workspace

    Discuss Discuss in Forum


  19. What does the fail() method do in JUnit?
  20. A.
    Throws an assertion error unconditionally
    B.
    Calls the default constructor
    C.
    Outputs the message Fail" to the console
    D.
    Pauses the test for 1 second

    View Answer

    Workspace

    Discuss Discuss in Forum