Posts

Building an API testing framework using RestAssured and TestNG with data-driven testing

Below are the detailed outline and sample code for building an API testing framework using RestAssured and TestNG with data-driven testing- Project Structure ` api-testing-framework/ │ ├── src/main/java/ │   └── utils/ │       └── ExcelUtils.java │ ├── src/test/java/ │   ├── base/ │   │   └── BaseTest.java │   │ │   ├── testcases/ │   │   └── ApiTest.java │   │ │   ├── testdata/ │   │   └── TestData.xlsx │   │ │   ├── resources/ │   │   └── config.properties │   │ │   └── testng.xml │ ├── pom.xml └── README.md `  Step 1: Add Dependencies in `pom.xml` Ensure your `pom.xml` has the necessary dependencies for RestAssured, TestNG, and Apache POI (for Excel data handling). `xml <dependencies>     <!-- RestAssured Dependency -->     <dependency>         <groupId>io.rest-assured</groupId>         <artifactId>rest-assured</artifactId>         <version>5.3.0</version>     </dependency>     <!-- TestNG Dependency -->     <depen

Selenium Cucumber BDD Framework with Java and TestNG | Page Factory

Image

Create a Page Object Model (POM) framework using Cucumber, Selenium, and Java

Create a Page Object Model (POM) framework using Cucumber, Selenium, and Java Creating a Page Object Model (POM) framework using Cucumber, Selenium, and Java is a structured way to organize your test automation code for better maintainability and scalability. Below is a simplified example of a POM framework using Cucumber, Selenium, and Java: Let's assume you're testing a simple web application with two pages: a login page and a home page. 1. **Create Your Page Classes:** Create two Java classes representing the login page and the home page. These classes should contain WebElement locators and methods to interact with the elements on those pages. **LoginPage.java:** ```java import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.By; public class LoginPage {     private WebDriver driver;     public LoginPage(WebDriver driver) {         this.driver = driver;     }     private WebElement usernameField() {         return driver.findEl

Cucumber and Gherkin definitions

Cucumber and Gherkin Cucumber is a widely used open-source testing tool that supports behavior-driven development (BDD) and facilitates collaboration among developers, testers, and non-technical stakeholders. It allows teams to define, automate, and execute test cases in a natural language format, making it more accessible to individuals with varying technical backgrounds. Cucumber helps bridge the gap between business requirements and test automation by using plain text feature files that are written in Gherkin language. Gherkin is a domain-specific language (DSL) designed to be human-readable and easy to understand. It serves as the language for defining the behavior of software systems in a structured format that Cucumber can interpret and execute. Gherkin is used to write test scenarios, which describe how a software system should behave in different situations. These scenarios are typically stored in feature files with a ".feature" extension. Gherkin scenarios consist

Create a PDF report with screenshots and logs using Selenium WebDriver in Java

Create a PDF report with screenshots and logs using Selenium WebDriver in Java Creating a PDF report with screenshots and logs using Selenium WebDriver in Java involves several steps. You'll need to use additional libraries like iText PDF for PDF generation and log4j for logging. Here's a step-by-step guide on how to achieve this: **Step 1: Set up your Java project** Create a new Java project or use an existing one. Make sure you have Selenium WebDriver and other necessary dependencies added to your project. **Step 2: Add dependencies** You'll need the following dependencies in your project: - Selenium WebDriver: For browser automation. - iText PDF: For generating PDF reports. - log4j: For logging. You can add these dependencies to your project using a build tool like Maven or by downloading JAR files manually and adding them to your classpath. **Step 3: Configure log4j** Create a log4j configuration file (e.g., `log4j.xml`) to configure logging settings. Place this file in

Selenium Cucumber BDD Framework with Java and TestNG - Login Test

Image

Building Cucumber BDD Framework from Scratch using Selenium and TestNG

Image
Building BDD Framework from Scratch using Cucumber Selenium and TestNG | Mini Project Cucumber is a popular open-source software testing tool that facilitates Behavior-Driven Development (BDD) practices. BDD is an approach to software development that emphasizes collaboration between developers, testers, and non-technical stakeholders to create a shared understanding of the desired behavior of a software system . Cucumber helps bridge the gap between technical and non-technical team members by using plain language specifications that are easily understandable by all parties involved. Here's a brief introduction to the Cucumber BDD framework: Feature Files: In Cucumber, the behavior of the software is described using plain text files called "feature files." These files contain scenarios that outline different aspects of the software's behavior. Each scenario is a collection of steps written in a structured, human-readable format . Gherkin Syntax: Cucumber uses Gh