Skip to main content

Selenium TestNG with Framework

 
Selenium Testing Frame work

Selenium TestNG with Framework

TestNG is a testing framework inspired from JUnit and NUnit. But introduce some new functionality that makes it more powerful and easier to use. It is an open source test framework where NG of TestNG means Next Generation. TestNG is like JUnit but it is much more powerful than JUnit but still, it’s inspired by JUnit. It is design to better than JUnit, especially when test integrated classes. Pay special thanks to Cedric Beust who is the author of TestNG.
TestNG eliminates most of the limitations of the older framework. Gives the developer the ability to write more flexible and powerful tests. With help of easy annotations, group, sequence & parametrize.

Advantages of TestNG

There are a number of benefits but from Selenium perspective, great advantages of TestNG:
It gives the capacity to provide HTML Reports of execution
Annotations made testers life easy
Test cases can Group & Prioritized easier
Parallel testing is possible
Generates Logs
Data Parameterization is possible

Test Case Writing

Write a test in TestNG is quite simple and involves below steps:
Step 1 – Write the business logic of the test
Step 2 – Insert TestNG annotations in the code
Step 3 – Add the information Example the class names, methods names, group names etc in a testing.XML file
Step 4 – Run TestNG

Annotations in TestNG

Before Suite: The annotated method will run before all tests in this suite have run.
After Suite: The annotated method will run after all tests in this suite have run.
Before Test: The annotated method should run before any test method. Belongs to the classes inside the tag will run.
After Test: The annotated method should run after all the test method. Belongs to the classes inside the tag have run.
Before Groups: The list of groups that this configuration method will run before. This method is the guarantee to run shortly before the first test method. Belongs to any of these groups is invoke.
After Groups: The list of groups that this configuration method will run after. This method is a guarantee to run shortly after the last test method. Belongs to any of these groups is invoke.
Before Class: The annotated method will run. Before the first test method in the current class is invoke.
After Class: The annotated method will run. After all the test methods in the current class have run.
Before Method: The annotated method will run before each test method.
After Method: The annotated method will run after each test method.
Test: The annotated method is a segment of a test case.

Benefits of using Annotations

It identifies the methods it is interested in by look up annotations. Hence method names are not restricted to any pattern or format.
We can pass extra parameters to annotations.


Comments

Popular posts from this blog

Web Driver Architecture​ | Best Selenium Online Training in Hyderabad

Best Selenium Online Training In Hyderabad Introduction​ Selenium WebDriver is one of the most powerful and popular tools of Selenium toolkit. WebDriver extended version to Selenium RC. WebDriver extends its support to many latest browsers and platforms, unlike Selenium IDE . WebDriver also doesn’t need Selenium server to start before execution of the Selenium RC . Selenium RC in aggregation with WebDriver API is Selenium 2.0 . Selenium was so developed to support dynamic web pages and Ajax calls . It also supports various drivers to exercise web-based mobile testing. Architecture​ WebDriver is a web-based testing tool with Selenium RC . The tool built on the fundamental where isolated clients create for each of the web browsers. WebDriver makes direct calls to the Web browser . The entire test script executes in this fashion. WebDriver uses the browsers support and capabilities to automation. Seleni...

Introduction of TestNG framework - Advantages of TestNG over Junit framework

 Introduction of TestNG framework - Advantages of TestNG over Junit framework In Selenium Web Driver training run Selenium scripts using JUnit framework. Until now we have executed seleniumtests but we have not generated reports in JUnit. We are introducing the powerful new testing framework called TestNG . The TestNG framework means Next Generation testing framework. So we are seeing all next generation features available in TestNG. I will talk about advantages of TestNG Framework TrainingIn Hyderabad over Junit. TestNG Framework Training In Hyderabad TestNG is popular JUnit framework used for the Java programming language. The TestNG framework introduced to overcome the limitations of JUnit framework. Most of the automation users are using this framework. Its advantages & more supported features. Until we have executed selenium test script but not even generated test reports. So using this TestNG framework learns to generate test reports. Features of ...

Selenium Uses of Manual Testing Training in Hyderabad

Manual Testing Manual Testing is referred to the process in a software tester sits. The through an end user software to determine the various flaws and bugs in the software. The process is generally carried out official launch of the app or website or software. The forms an integral part of the quality assessment of a software.   Selenium Uses of Manual Testing Training in Hyderabad software testing was done using automated methods. Developers tend to use automated scripts. The computers for the purpose of the process made easy. The graphical interface, games, e-commerce sites and interface of apps, manual tests preferred. These tests preferred user experience is matters and to ensure the end user use the service. The testing using manual methods is quite important. the e-commerce and game developers use manual testers . their app or site is working as per the convenience of the public and not causing any bug during use. How does ...