i
WebDriver Introduction
Selenium WebDriver Architecture
Introduction to WebDriver API
Introduction to WebDriver – Code
Handling Dropdowns and Select class
Handling Multiple Dropdown values and Links
Handling Radio buttons and Checkboxes
Capture Screenshots and Email test results
Browser Navigation Methods
Handling tabs
Capturing screenshot, Handling tabs and pop-ups – Code
Handling tabs and Pop-ups – Code
Handling Alerts
Handling User Authentication and Input alerts
HtmlUnitDriver and Handling Captchas
Handling Web Tables
Synchronization
Handling WebTables, Synchronization issues, Firefoxprofiles – Code
Actions Class
Event Listeners, Event Firing Mouse, Coordinates – Code
Handling Mouse Hover in Selenium
JavascriptExecutor
Handling Iframes
IsElementPresent, IsEnabled, IsSelected
Working with Chrome Driver - Part 1
Working with FireFox Driver - Part 2
Working with Internet Explorer Driver - Part 3
Handling SSL Certificate
Desired Capabilities
How to Encode password in WebDriver
Handling JQuery Elements - Drag and Drop, Sliders, Resizable
Handling JQuery Elements - Drag and Drop, Sliders, Resizable – Code
Working on IE Browser using Actions
TestNG, Ant & Report Generation through XSLT
Introduction to TestNG and Annotations
TestNG Parameterization
Configuring ANT, Generating TestNG & XSLT Reports
Code for generating XSLT / Surefire Reports through MAVEN
TestNG Parameterization Excel Reading
Handling Multiple data providers
TestNG XSLT Jar, Build.xml & TestNG.xml file
Frameworks Introduction
Hybrid (DATA + KEYWORD) driven Framework
Framework Architecture
Reading Excel sheets
TestNG DataProvider
Data Provider with Hashtable
Handling Multiple Test Suites
Multiple DataProviders
Setting up Run-modes at Suite Level
Setting up Runmodes at TestCase Level
Creating a common utility for Run-modes
Hybrid Framework Code
TestNG
Ant
Ant is a build tool that helps in taking care of third-party APIs, Classpath of the APIs, the Cleaning process of the previous executable binary file, Compiling, and execution of source code.
Ant helps us in the creation, execution, and automation of the entire process, as described in its configuration file build.xml.
Let’s install Ant:
Below are the steps to install Ant into your machine.
;C:\Users\apache-ant-1.9.14\bin
Build.xml is an essential file for Ant-based build configurations for cleaning, compiling, and execution of the code.
Sample Build.xml file:
XSLT Reporting
Reporting is an essential part of a robust Selenium framework, and TestNG provides necessary HTML reports by default. For enhancing the report, we can use XSLT(Extensible Stylesheet Language Transformation). XSLT transforms the XML documents into other useful XML documents, such as XHTML, which are used by the browser.
We can utilize TestNG, Ant, and XSLT to create amazing HTML reports for our Selenium Test suite. Let us see how to form an XSLT reporting into our Selenium code with the help of the TestNG and Ant build tool. Let us see the steps to create the XSLT report.
Create a TestNG Project:
Let’s see the sample code of a TestNG project:
package SeleniumTest.SeleniumTest;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class XSLTReportingAntTestNG {
WebDriver driver ;
@BeforeMethod
public void startDriver()
{
driver=new ChromeDriver();
this.driver.get("https://selflearning.io/");
}
@Test
public void passTest() {
Assert.assertTrue(true);
}
@Test(priority=0)
public void failTest()
{
Assert.assertTrue(false);
}
}
Install the Ant:
We have seen earlier how to install the Ant. We need this to be installed to create the build for generating the XSLT report. We will use the build.xml file of Ant to generate the report.
Copy XSLT files into your Project:
I have put on my google drive link here. You can download the files from the drive and paste all the files to your project folder.
Now Run the TestNG Project:
Let us now run the TestNG test from eclipse:
Run the build.xml
Now we need to run the build.xml file. A sample of build.xml looks like this:
name="TestAutomation" basedir=".">
name="LIB" value="${basedir}/lib" />
name="BIN" value="${basedir}/bin" />
id="master-classpath">
location="${BIN}" />
dir="${LIB}" includes="*.jar"/>
name="generateReport">
dir="${basedir}/testng-xslt">
dir="${basedir}/testng-xslt">
in="${basedir}/test-output/testng-results.xml" style="${basedir}/testng-results.xsl" out="${basedir}/testng-xslt/index.html">
expression="${basedir}/testng-xslt/" name="testNgXslt.outputDir" />
expression="true" name="testNgXslt.sortTestCaseLinks" />
expression="FAIL,SKIP,PASS,CONF,BY_CLASS" name="testNgXslt.testDetailsFilter" />
expression="true" name="testNgXslt.showRuntimeTotals" />
refid="master-classpath">
Now run the build.xml as “Ant Build”.
Once build gets successful, it will generate the output files under “testing-XSLT" folder for the XSLT reports as shown below:
Click in the index.html file in the "testing-XSLT" folder. XSLT report gets displayed in the web browser.
Don't miss out!