Package core.support.rules
Class RetryTest
- java.lang.Object
-
- core.support.rules.RetryTest
-
- All Implemented Interfaces:
org.junit.rules.TestRule
public class RetryTest extends Object implements org.junit.rules.TestRule
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRetryTest.ReportType
-
Field Summary
Fields Modifier and Type Field Description static booleanenableRetrystatic String[]PageErrorsstatic intRETRYCOUNTERorg.openqa.selenium.WebDriverwebDriver
-
Constructor Summary
Constructors Constructor Description RetryTest(int retryCount)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.junit.runners.model.Statementapply(org.junit.runners.model.Statement base, org.junit.runner.Description description)voiderrorHandling(Throwable t)error handling When test fails if any of the defined errors specified by PageErrors exists, Then the test will be retriedstatic ArrayList<String>getAllFiles(File curDir)intgetCurrentTestRun()voidgetPageSource()print page sourceintgetRetryCount()static StringgetStackTrace(Throwable throwable)gets the stack trace of the failurecom.aventstack.extentreports.ExtentTestgetStep()com.aventstack.extentreports.ExtentTestgetTest()voidlogReport(RetryTest.ReportType type, String value, Throwable t)booleanpageHasError(Throwable t)returns true if any of the error types specified is caughtvoidprocessTestResult(org.junit.runner.Description description)voidrandomFailStack(ArrayList<String> FailTrace, org.junit.runner.Description description)voidsetExtendReport(com.aventstack.extentreports.ExtentTest test, com.aventstack.extentreports.ExtentTest step, com.aventstack.extentreports.ExtentReports extent)voidsetRetryCount(int retryCount)voidsetTestId(org.junit.runner.Description description)voidsetWebDriver(org.openqa.selenium.WebDriver driver)voidtakeAppcenterScreenshot(String label)voidwriteToTestReport()
-
-
-
Field Detail
-
PageErrors
public static final String[] PageErrors
-
RETRYCOUNTER
public static final int RETRYCOUNTER
-
enableRetry
public static boolean enableRetry
-
webDriver
public org.openqa.selenium.WebDriver webDriver
-
-
Method Detail
-
setRetryCount
public void setRetryCount(int retryCount)
-
getRetryCount
public int getRetryCount()
-
getCurrentTestRun
public int getCurrentTestRun()
-
setExtendReport
public void setExtendReport(com.aventstack.extentreports.ExtentTest test, com.aventstack.extentreports.ExtentTest step, com.aventstack.extentreports.ExtentReports extent)
-
getTest
public com.aventstack.extentreports.ExtentTest getTest()
-
getStep
public com.aventstack.extentreports.ExtentTest getStep()
-
setWebDriver
public void setWebDriver(org.openqa.selenium.WebDriver driver)
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)- Specified by:
applyin interfaceorg.junit.rules.TestRule
-
getPageSource
public void getPageSource()
print page source
-
setTestId
public void setTestId(org.junit.runner.Description description)
-
takeAppcenterScreenshot
public void takeAppcenterScreenshot(String label)
-
processTestResult
public void processTestResult(org.junit.runner.Description description) throws Throwable- Throws:
Throwable
-
writeToTestReport
public void writeToTestReport()
-
logReport
public void logReport(RetryTest.ReportType type, String value, Throwable t)
-
pageHasError
public boolean pageHasError(Throwable t)
returns true if any of the error types specified is caught- Parameters:
t-- Returns:
-
errorHandling
public void errorHandling(Throwable t)
error handling When test fails if any of the defined errors specified by PageErrors exists, Then the test will be retried- Parameters:
t-
-
randomFailStack
public void randomFailStack(ArrayList<String> FailTrace, org.junit.runner.Description description)
-
getStackTrace
public static String getStackTrace(Throwable throwable)
gets the stack trace of the failure- Parameters:
throwable-- Returns:
-
-