Created
April 11, 2024 07:17
-
-
Save SarahElson/c14c3d87b2a4cca55cd182f2a1113701 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.mfaisalkhatri.tests.retrytests; | |
| import static 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 | |
| public void testSearchProduct () { | |
| final String productName = "Canon EOS 5D"; | |
| final SearchResultPage searchResultPage = this.homePage.searchProduct (productName); | |
| assertEquals (searchResultPage.pageHeader (), "Search - " + productName); | |
| assertEquals (searchResultPage.getFirstSearchResultText (), "Canon eos 5D"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment