Package tests
Class BaseTest
java.lang.Object
tests.BaseTest
- Direct Known Subclasses:
TS01_CreateBook
,TS02_GetBook
,TS03_UpdateBook
,TS04_DeleteBook
Base test class for API tests, providing setup and teardown logic.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Runs before each test, sets up thread context.void
Resets the books after the test suite completes.io.restassured.response.Response
retryRequest
(Supplier<io.restassured.response.Response> request) Retries a request if HTTP 429 is received, up to MAX_RETRY_COUNT.void
Runs before each test method, sets up thread context.void
Sets up the test suite with base URI, path, and filters.void
teardown()
Runs after each test method, clears thread context.
-
Field Details
-
USER_AUTH_TOKEN
- See Also:
-
USER_ADMIN_TOKEN
- See Also:
-
logger
protected org.apache.logging.log4j.Logger logger -
MAX_RETRY_COUNT
protected static final int MAX_RETRY_COUNT- See Also:
-
-
Constructor Details
-
BaseTest
public BaseTest()
-
-
Method Details
-
setUpSuite
@BeforeSuite(alwaysRun=true) public void setUpSuite()Sets up the test suite with base URI, path, and filters. -
beforeTest
@BeforeTest(alwaysRun=true) public void beforeTest()Runs before each test, sets up thread context. -
setup
Runs before each test method, sets up thread context.- Parameters:
method
- the test method
-
teardown
@AfterMethod(alwaysRun=true) public void teardown()Runs after each test method, clears thread context. -
resetBooksAfterSuite
@AfterSuite(alwaysRun=true) public void resetBooksAfterSuite()Resets the books after the test suite completes. -
retryRequest
public io.restassured.response.Response retryRequest(Supplier<io.restassured.response.Response> request) Retries a request if HTTP 429 is received, up to MAX_RETRY_COUNT.- Parameters:
request
- the request supplier- Returns:
- the response
-