Created
April 11, 2024 05:20
-
-
Save SarahElson/0aeac69fb33058d64bfde00b8c77d1ed to your computer and use it in GitHub Desktop.
How To Retry Failed Tests Using IRetryAnalyzer In TestNG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.github.mfaisal, the expected text is updated tostatic io.github.mfaisalkhatri.drivers.DriverManager.getDriver; | |
import static org.testng.Assert.assertEquals; | |
import io.github.mfaisalkhatri.listeners.Retry; | |
import io.github.mfaisalkhatri.pages.lambdatestecommerce.HomePage; | |
import io.github.mfaisalkhatri.pages.lambdatestecommerce.LoginPage; | |
import io.github.mfaisalkhatri.pages.lambdatestecommerce.SearchResultPage; | |
import io.github.mfaisalkhatri.tests.base.BaseSuiteSetup; | |
import org.testng.annotations.BeforeClass; | |
import org.testng.annotations.Test; | |
public class RetryFailedTests extends BaseSuiteSetup { | |
private HomePage homePage; | |
@BeforeClass | |
public void setupTests () { | |
final String website = "https://ecommerce-playground.lambdatest.io/"; | |
getDriver ().get (website); | |
this.homePage = new HomePage (); | |
} | |
@Test (retryAnalyzer = Retry.class) | |
public void testNavigationToLoginPage () { | |
final LoginPage loginPage = this.homePage.navigateToLoginPage (); | |
assertEquals (loginPage.loginBoxTitle (), "Returning Customesr"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment