About - Selenium

Definition

Development and Versions

Pre-requisites

Languages supported

Manual vs Automation

Choosing Selenium

Selenium - Components

Selenium IDE

Selenium RC

Selenium WebDriver

Selenium Grid

QTP

Selenium vs QTP

Selenium - IDE

Features

Install and configure

Selenium - Webdriver

About WebDriver

install and configure

First test case

Web element

Element Locators

Example of locators

Chropath

Web driver commands

Eclipse and TestNG

About Eclipse

Choose and download

About TestNG

Testng installation on eclipse

Testng Annotations

Pass Fail and Skip test cases

Run test cases in batch

testng.xml - Explanation

testng grouping

Running tests parallely

dependsOnMethods

dependsOnGroups

Prioritization

Passing parameters

Data providers

Read data from excel

Ant - XSLT reports

Testng listeners

Cross browser testing

Page Object Model



Selenium - Run test cases in batch
 


There is a provision to run tests in batch with the following technique in TestNG. This is a TestNG feature.

a) So far we have seen executing only one Testclass file and all the tests in that particular test class file running with TestNG class

b) Now we will see how to run or execute multiple class files with the help of xml file. This file is generally named as testng.xml but you can name it as whatever you want but the file type should be xml.

Even if you don't create a TestNG suite for one class, TestNG automatically create a default suite for each execution.

c) If you don't know how to create testng.xml file then do the following:

d) Right click on Project and you can see TestNg-> Convert to TestNG.

e) Then click on Next and then Finish





Once finished, the following file will be generated under the project folder.

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> <suite name="LoginSuite">
<test thread-count="5" name="LoginTest">
<classes>
<class name="com.testngdemo.TestNGDemo1"/>
<class name="com.testngdemo.LoginFunctionality"/>
</classes>
</test>
</suite>

Explanation of testng.xml:

a) You can choose any name for test and suite tags. Here I have given LoginSuite and LoginTest.
b) But for classes you have to provide exact class path of the Test Classes.
c) Now if you want to run all the test classes (Multiple Test classes) , right click on testng.xml file and select Run as-> Test Suite and all the tests in both classes Login Functionality and Demo files are executed.

Now verify the console below:
[RemoteTestNG] detected TestNG version 6.14.3
in beforeSuite
in beforeTest
Inside test case 1
Start bowser
User enters the login data
User Successfully logged in
Logged out to User account
Stop browser
in afterTest
in afterSuite

===============================================
Suite
Total tests run: 2, Failures: 0, Skips: 0
===============================================

You can verify both tests in both class files are executed and passed. This is called running TestNG files in batch.


I conduct online tutions on Manual Testing, Selenium and the following. For more details contact anandaibmindia@gmail.com
Manual Testing - 1600/-           Selenium - 1600/-
           Jsp and Servlet -2000/-           Java training - 2000/-