I am using latest version of TestNG but still not able execute testcases by the order it has been written(avoiding priority annotation tag).
import org.testng.annotations.Test;
public class NewTest {
@Test
public void b() {
System.out.println("inside b method");
}
@Test
public void a() {
System.out.println("inside a method");
}
}
I have also used IMethodInterceptor but still no go.
in testng.xml also added listeners:
<listeners>
<listener class-name="testngdemo.PriorityInterceptor" />
</listeners>
but still getting following output
inside a method
inside b method
Priority interface:
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
@Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
@Target({METHOD, TYPE})
public @interface Priority { int value() default 0; }