Every application that is created by a developer has to be tested for its functionality. JUnit is one such testing platform that uses Java as a mainstream language. If you are a JUnit aspirant, make sure you have studied the questions that could be possibly asked by the interviewer.
Here is a list of probable JUnit Interview Questions that can be asked:
Determine one or more public test XYZ() methods that exercise the objects under test and assert expected results.
|In JUnit the naming convention for annotation is a bit complicated for, e.g., “Before”, “After” and “Expected”.||In TestNG it is easier to understand annotations like “BeforMethod”, “AfterMethod” and “ExpectedException”.|
|In JUnit, for a method declaration you have to follow a specific style like using “@BeforeClass” and “@AfterClass”.||In TestNG, there is no restriction like you have to declare methods in a specific format.|
|In JUnit method name constraint is present.||In TestNG method name constraint is not present, and you can determine any test method names.|
|JUnit framework does not have “Parameterized Test” or “Dependency Test” features.||TestNG use “dependOnMethods” to implement the dependency testing.|
|In JUnit grouping of test cases are not available.||In TestNG, grouping of test cases is available.|
|JUnit does not support parallel execution on Selenium test cases.||In TestNG Parallel execution of Selenium test cases are possible.|
|It cannot re-run the failed cases.||It can rerun the failed tests.|
Never Miss an Articles from us.