TestNG :
What is TestNG?
TestNG is a testing framework inspired by JUnit and NUnit but designed to cover a wider range of test categories, from unit tests to integration tests.
Why should we go for TestNG?
TestNG offers several advantages that make it a preferred choice for testing:
You can run a single class or multiple classes.
Example: Running as a Java application
A.Java
B.Java
C.Java
You can group test cases for different types of testing such as smoke
tests, regression tests, and integration tests.
ex: smoke test cases
regression test cases
Integration test cases
You can run test cases based on priority
test(priority
=0) --> 1st
test(priority
=1) --> 2nd
You can run test cases in parallel--> parallel
testing
tc1
tc2
tc3
Can run all test
cases at the same time
tc1 6pm
tc2 6pm
tc3 6pm
TestNG allows you to generate reports and log user-defined messages.
Java - Syso.println("");
Selenim - will not generate any automation results - so
we go for TestNG
We can perform DDT
Data Driven
Testing : testing the application with
multiple/different sets of data
Example 1: Login functionality
with different users and passwords.
user pwd
-----------------
ram, mercury
Sita, mercury
Raju, mercury
Example 2: Creating orders with
different product names, quantities, and addresses.
Productname
Qty
Address
------------------------------
Samsung,
2, BNG
Shampoo,
3, CHN
Santoor,
5, HYD
Download testNG:
Refer: https://www.guru99.com/install-testng-in-eclipse.html
To
install TestNG in Eclipse, follow these steps:
- Go to the Eclipse Help
menu.
- Select Eclipse
Marketplace.
- In the search bar, type
"TestNG" and press Enter.
- You will see "TestNG
for Eclipse" plugin. Click the Install button.
- Click Next.
- Accept the terms by
selecting the Accept terms... radio button.
- Click Next.
- If any warning messages
appear, click OK and continue.
- Restart Eclipse.
Verify TestNG Installation
To verify if TestNG is installed, follow these steps:
- Go to Window > Show View > Other.
- Search for
"TestNG".
- If
TestNG is installed, it will display the 'TestNG' option.
- If
TestNG is not installed, it will not display the 'TestNG' option.
TestNG can be referred to as both a plugin and a library.
Add TestNG Library
To add the TestNG library to your project, follow these steps:
- Select
your project.
- Right-click
and select Properties.
- Go to Java Build Path.
- Click
the Libraries tab.
- Click/ Select Class Path
- Click Add Library.
- Select
the TestNG option and click Next.
- Click Apply and Close.
- Check
the 'TestNG' library file added to your project.
To verify, check in the Project Explorer
window to see if TestNG exists.
No comments:
Post a Comment