Selenium WebDriver With JUnit Interview Questions With Answers Part 12

Part 12

53 : Which Is the latest version of JUnit.

Answer : Current latest version of JUnit Is 4.12-beta-2. This tin move modify In future. To cheque latest released version of JUnit, You tin move Visit JUnit Official WebSite.
54 : Tell me dissimilar JUnit annotations too Its usage.

Answer : JUnit has bellow given dissimilar annotations.
  • @Test  : @Test musical note Is useful to Identify method equally a Test method from software automation exam script.
  • @Before : @Before musical note method volition last executed earlier each too every @Test method.
  • @After : @After annotation method volition last executed later each too every @Test method.
  • @BeforeClass : @BeforeClass annotation method volition last executed earlier all @Test methods In a class(Means earlier first @Test method).
  • @AfterClass : @AfterClass annotation method volition last executed later all @Test method In a class(Means later final @Test method).
  • @Ignore : @Ignore musical note Is useful to exclude @Test method from execution. VIEW EXAMPLE
  • @Test(timeout=1000) : You tin move set @Test method execution timeout. This @Test method fails Immediately when Its execution fourth dimension cross M milliseconds.
VIEW PRACTICAL EXAMPLE of JUnit annotations amongst selenium webdriver software testing tool.

55 : Write sample JUnit @Test method that passes when expected ArithmeticException thrown.

Answer : Sample JUnit @Test to exceed on expected ArithmeticException Is equally bellow.
@Test(expected = ArithmeticException.class)   world void excOnDivision() {       int i = 5/0; }

VIEW PRACTICAL EXAMPLE for Junit Timeout And Expected Exception software Test.

56 : Write sample JUnit @Test method that fails when unexpected ArithmeticException thrown.

Answer : Sample JUnit @Test to neglect on unexpected ArithmeticException Is equally bellow.
@Test   world void excOnDivision() {       int i = 5/0; }

57 : What are the advantages of TestNG over JUnit.

Answer : Advantages of TestNG over JUnit JUnit are equally bellow.





  • TestNG Annotations are uncomplicated too Easy to understand.
  • Easy to parameterize the software exam cases In TestNG.
  • Easy to run software automation exam cases In parallel.
  • Can generate Interactive XSLT exam execution reports using TestNG.



  • More interesting articles here :Generation Enggelmundus Internet Marketing Tool here :Zeageat IM http://www.software-testing-tutorials-automation.com/
    Post a Comment (0)
    Previous Post Next Post