Interview Questions With Detailed Answers On Selenium

Part 18

83 : What are the benefits of parallelism over normal execution?

Answer : Using parallelism facility of TestNG In selenium webdriver,
  • Your software test execution time will be reduced as multiple tests will be executed simultaneously.
  • Using parallelism, We can verify multithreaded code In software application.
84 : I wants to run test cases/classes In parallel. Using which attribute and value I can do It?

Answer : You have to use parallel = classes attribute In testng.xml to run software web app tests parallel. VIEW EXAMPLE.

85 : What Is dependency test In TestNG?

Answer : Dependency Is very good feature of testng using which we can set software test method as dependent test method of any other single or multiple or group of test methods. That means depends-on method will be executed first and then dependent test method will be executed. If depends-on software test method will fail then execution of dependent test method will be skipped automatically. TestNG dependency feature will works only If depends-on test method Is part of same class or part of Inherited base class. DETAILED DESCRIPTION ON DEPENDENCY.

86 : What Is the syntax to set test method dependency on multiple test methods.

Answer : We can set test method's dependency on multiple test methods as bellow.
@Test(dependsOnMethods={"Login","checkMail"})
    public void LogOut() {
  System.out.println("LogOut Test code."); 
    }

Above test method Is depends on Login and checkMail test methods. VIEW EXAMPLE.

87 : What Is the syntax to set test method disabled.

Answer : We can use attribute enabled = false with @Test annotation to set test method disabled. Syntax Is as bellow.

@Test(enabled = false)
    public void LogOut() {
  System.out.println("LogOut Test code."); 
    }

Disabled software test methods will be excluded automatically during execution. VIEW PRACTICAL EXAMPLE.

No comments:

Post a Comment