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

SoftwareTestingo - Jira Selenium Protractor Testing SDLC Agile Methodology

Java Selenium Tutorial & Testing Interview Questions

  • Home
  • Interview Questions
  • Java
  • Java Programs
  • Test Cases
  • Selenium
  • Manual Testing
  • Difference
  • Search
SoftwareTestingo » Selenium » 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: 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

    Tutorials Important Links

    • Software Testing Jobs
    • Manual Testing Tutorial
    • Selenium Tutorial
    • Core Java Tutorial
    • TestNG Tutorial
    • Java Programs
    • Selenium Programs
    • Manual Test Cases
    • Interview Tips
    • Contact US
    • www.softwaretestingo.com

    Important Links

    • Software Testing Interview Questions
    • Agile Interview Questions
    • Manual Testing Interview Questions
    • Testing Interview Questions
    • Selenium Interview Questions
    • Selenium Real Time Interview Questions
    • Selenium WebDriver Interview Questions
    • Automation Framework Interview Questions
    • Appium Interview Questions
    • TestNG Interview Questions
    • Java Interview Questions
    • Core Java Interview Questions

    Categories

    Copyright © 2021 SoftwareTestingo.com ~ Contact Us ~ Sitemap ~ Privacy Policy