• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

SoftwareTestingo - Interview Questions, Tutorial & Test Cases Template Examples

SoftwareTestingo - Interview Questions, Tutorial & Test Cases Template Examples

  • Home
  • Test Case Examples
  • Interview Questions
  • Interview Questions Asked
  • Java
  • Selenium
  • Manual Testing
  • SQL Tutorial For Beginners
  • Difference
  • Tools
  • Contact Us
  • Search
SoftwareTestingo » Selenium » Free Selenium Tutorial » How TestNG Enabled Annotation Works In Selenium Example Program?

How TestNG Enabled Annotation Works In Selenium Example Program?

Last Updated on: June 6, 2020 By Softwaretestingo Editorial Board

What We Are Learn On This Post

  • TestNG Enabled Annotation Works Example

TestNG Enabled Annotation Works Example

How does TestNG Enabled Annotation work In Selenium Example Program?

package com.selenium.TestNG;
import org.testng.annotations.Test;
public class AlwaysRunTest 
{
   @Test(priority=0)
    public void methodfail() { 
      System.out.println("Fail Method");
    }
    @Test(dependsOnMethods="error",priority=2) 
    public void alwaysruntrue() { 
      System.out.println("Always run is true");
    }   
    @Test(enabled=true,priority=1)
   public void error()
    {
    	System.out.println("Exception Occured");
    }
}
package com.selenium.TestNG;
import org.testng.Assert;
import org.testng.annotations.Test;
public class Testng_AlwaysRun 
{
   @Test
   public void show()
   {
      System.out.println("Show Executed");
      Assert.assertFalse(2>1);
   }
   @Test(enabled=true)
   public void show1()
   {
      System.out.println("Show1 Executed");
      Assert.assertEquals("manoj", "hjg");	
   }
   @Test(dependsOnMethods="show1",alwaysRun=true) // There Is No Such Option For False
   public void show2()
   {
      System.out.println("Show2 Executed");
   }
}
Read Also: TestNG Group Annotation Works In Selenium

    Filed Under: Free Selenium Tutorial

    Reader Interactions

    Leave a Reply Cancel reply

    Your email address will not be published. Required fields are marked *

    Primary Sidebar

    Join SoftwareTestingo Telegram Group

    Categories

    Copyright © 2023 SoftwareTestingo.com ~ Contact Us ~ Sitemap ~ Privacy Policy ~ Testing Careers