mardi 6 juin 2017

Can we pass two annotation(IRetryAnalyzer and priority) type as one in TestNG

I have a situation where want to use IRetryAnalyzer and priority at a single time for testcase as an example. I want to use/apply below two parameter to a single testcase

@Test(retryAnalyzer = test1.Retry.class)
@Test(priority=0)

Example :-

@Test(retryAnalyzer = test1.Retry.class)
@Test(priority=0)
public void Test1()
{
    System.out.println("Retry attempt");
    i++;
    System.out.println("value of i ="+i);
    if(i<2)
    {
        System.out.println("I m in fail Fail");
        Assert.assertEquals(false, true);
    }
    if(i>=2) {
        System.out.println("I m in fail pass");
        Assert.assertEquals(false, false);
    }
}

enter image description here

Is there any way where I can apply both to a single testcase.

Aucun commentaire:

Enregistrer un commentaire