Posts

Showing posts from September, 2023

BaseSteps.java : Extent report configuration & Screenshot code implementation

  package com.automationexercise.automationUtilities; import com.aventstack.extentreports.ExtentReports; import com.aventstack.extentreports.ExtentTest; import com.aventstack.extentreports.reporter.ExtentSparkReporter; import com.aventstack.extentreports.reporter.configuration.Theme; import io.github.bonigarcia.wdm.WebDriverManager; import org.apache.commons.io.FileUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.edge.EdgeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.annotations. AfterClass ; import org.testng.annotations. AfterMethod ; import org.testng.annotations. BeforeClass ; import org.testng.annotations. BeforeMethod ; import java.io.File; import java.io.IOException; import java.time.Duration; import java.util.P...

log4j2.xml

Image
LOG4J2: Log 4j is used to capture the run time logs of the application or our automation framework execution details, We can configure the information we need and that can be shown on console so that it becomes easy to understand the flow or we can start keeping the log information in to a file and can see the details there as well Since log4j 1.x has vulnerabilities and is no longer supported. We can see it in Maven Central Repository. We need to go with log4j2 .Add log4j core and log4j api into pom.xml as dependencies. Log4j2 configuration can be done in two ways i.e. using log4j2.xml and log4j2.properties In this framework I will be using log4j2.xml Log levels in log4j: Trace < Debug < Info < Warn < Error < Fatal< Off 1.        OFF 2.        FATAL 3.        ERROR 4.        WARN 5.        INFO 6.    ...

pom.xml

  <? xml version ="1.0" encoding ="UTF-8" ?> < project xmlns ="http://maven.apache.org/POM/4.0.0" xmlns: xsi ="http://www.w3.org/2001/XMLSchema-instance" xsi :schemaLocation ="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" > < modelVersion > 4.0.0 </ modelVersion > < groupId > qaautomationclasses </ groupId > < artifactId > SeleniumFrameworkDemo </ artifactId > < version > 1.0-SNAPSHOT </ version > < properties > < maven.compiler.source > 20 </ maven.compiler.source > < maven.compiler.target > 20 </ maven.compiler.target > < project.build.sourceEncoding > UTF-8 </ project.build.sourceEncoding > </ properties > < build > < plugins > < plugin > < groupId > org.apache.maven.plugins <...