TestNGの最新バージョンを使用していますが、テストケースを書き込まれた順番で実行できません(優先アノテーションタグを避けて)。優先度を使用しないTestNGでの実行順序
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");
}
}
私もIMethodInterceptorまだありません行くを使用していました。
testng.xmlでも追加のリスナー:
<listeners>
<listener class-name="testngdemo.PriorityInterceptor" />
</listeners>
が、それでも次の出力
inside a method
inside b method
を得ることが優先インターフェイス:
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; }
http://stackoverflow.com/questions/ 2669576 /このテストで何が問題になっているのか? –
@ImeshaSudasingha私はjacobcsと同じ手順に従ったが、アルファベット順に実行している。 –
@ImeshaSudasingha私はメソッドIDを取得するが、実行されていない。 優先度は[MethodInstanceメソッド= NewTest.b()[pri:0、インスタンス:[email protected]] instance = [email protected]] メソッド:b結果:0 –