Skip to main content

Posts

Showing posts from January, 2022

What is IInvokedMethod Listeners in TestNG and how to implement IInvokedMethod Listener

IInvokedMethod Listener performs some tasks before and after the methods execute. We generally use it for setting up configurations or cleanup etc.  IInvokeListener invokes before and after every test method available in the test code, unlike ITestListener. The IInvokedMethod listener contains two methods: beforeInvocation(): This method invokes before every method. afterInvocation(): This method is invoked after every method. Code example: package IInvokedMethod; import org.testng.IInvokedMethod; import org.testng.IInvokedMethodListener; import org.testng.ITestResult; public class ListenerTestNG implements IInvokedMethodListener{ @Override public void beforeInvocation(IInvokedMethod method, ITestResult testResult) { // TODO Auto-generated method stub System.out.println("This is my listener beforeInvocation logs : "+method.getTestMethod().getMethodName()+ " " + " of the class " +testResult.getTestClass()); } @Override public void after

What is ISuiteListener In TestNG

  ISuiteListener  is another type of listener provided in TestNG this listener works on the suite level. ISuiteListener listens to the event of the start of a suite execution and end of the suite execution.  ISuiteListener runs the methods only before the start of the suite and at the end. It contains two methods: onStart :  This method invokes before the test suite execution starts . onFinish :  This method invokes after the test suite execution ends .   One should note that if the parent suite contains child suites then the child suites are executed before the parent suite. Code example: package isuiteListener; import org.testng.ISuite; import org.testng.ISuiteListener; public class ListenersTest implements ISuiteListener{ @Override public void onStart(ISuite suite) { // TODO Auto-generated method stub System.out.println("this is on start function  "+suite.getName()); } @Override public void onFinish(ISuite suite) { // TODO A

Extent Reports

  1.       ExtentReports is an logger-style reporting library for automated tests. 2.       A logger is simply an object to log messages or events for a specific system or application. 3.       ExtentReports uses the logging style to add information about test sessions, such as creation of tests, adding screenshots, assigning tags, and adding events or series of steps to sequentially indicate the flow of test steps.   Extent Reports in Selenium contain two frequently used classes: ·         ExtentReports class ·         ExtentTest class Syntax ExtentReports reports = new ExtentReports(" Path of directory to store the resultant HTML file ", true/false); ExtentTest test = reports.startTest("TestName");   Both classes can be used with the following built-in methods: ·         startTest : Executes preconditions of a test case ·         endTest : Executes postconditions of a test case ·         Log : Logs the status of each test step onto the HT

Webservices Interview Questions

  1. What is Web Service The Web Service is a standard software system used for communication between two devices (client and server) over the network or Say exchanging information between two applications over the network. 2. How Does a Web Service Work? A web service enables communication among various applications by using open standards such as HTML, XML, WSDL, and SOAP. You can build a Java-based web service on Solaris that is accessible from your Visual Basic program that runs on Windows. 3. Explain web service architecture? Web service framework architecture consists of three different layers. Service Provider: Service provider role is to create the web service and makes it accessible to the client applications over the internet for their usage. Service Requestor: Service Requestor is basically any consumer of web service like any client application. Client applications are written in any language. They contact web service for any type of functionality by sending XML requests ov