How to implement SuccessPercentage in TestNG

Hi ,
I am a newbie in TestNG and learning the TestNG annotaions from toolsqa and http://testng.org/doc/documentation-main.html but there isn’t any example explaining this parameter.

Can anyone explain with code the example of successpercentage? and

what is use of this in real world example?

Thanks! in advance :)

I am using the below code using success percentage as 100 but always it passes.I guess it shoud not pass because two iterates are failing here

package Pack;

import java.io.IOException;

import org.testng.annotations.Test;

public class SuccessPercentage {

@Test(timeOut = 10000, invocationCount = 1, successPercentage = 100)
public void waitForAnswer() throws InterruptedException{
int i=10;
while (i>2){
try{

System.out.println(i);
Thread.sleep(1000);
i–;
}
catch(Exception e)
{
System.out.println(e);
}

}
}

}

iamsethi Default Asked on June 21, 2015 in Selenium WebDriver.
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.