Priority is an attribute that tells TestNG which orders have to follow to run test method. It is used to set the order of test cases as ours need.
Eg:
@Test (priority=2)
public void getText()
{
driver.findElement(By.id(“id”)).getText();
}
@Test(priority=1)
public void clickelement()
{
driver.findElement(By.id(“id”)).click();
}