TestNG- Advantages from SELENIUM point of view
Posted by Infocampus HR on April 19th, 2017
JUnit has driven engineers to comprehend the value of tests, particularly of unit tests, when contrasted with whatever other testing system. Utilizing a somewhat straightforward, down to business, and strict engineering, JUnit has possessed the capacity to "contaminate" extraordinary number of designers. JUnit, in the meantime, has a few weaknesses too, which are recorded underneath:
What is TestNG?
TestNG is a trying structure motivated from JUnit and NUnit however presenting some new usefulness that make it all the more intense and less demanding to utilize.
It is an open source computerized testing system; where NG of TestNG means Next Generation. TestNG is like JUnit yet it is a great deal more intense than JUnit yet it's roused by JUnit. It is intended to be superior to JUnit, particularly when testing coordinated classes. Pay uncommon on account of Cedric Beust who is the maker of TestNG.
TestNG disposes of a large portion of the constraints of the more seasoned structure and gives the engineer the capacity to compose more adaptable and effective tests with help of simple comments, gathering, sequencing and parametrizing.
Advantages of TestNG:
There are number of advantages yet from Selenium point of view, real favorable circumstances of TestNG are:
Writing Test case:
Composing a test in TestNG is very straightforward and essentially includes taking after strides:
Step 1 – Write the business rationale of the test
Step 2 – Insert TestNG explanations in the code
Step 3 – Add the data about your test (e.g. the class names, techniques names, bunches names and so on…) in a testng.xml record
Step 4 – Run TestNG
Explanations in TestNG:
@BeforeSuite: The clarified strategy will be keep running before all tests in this suite have run.
@AfterSuite: The clarified strategy will be pursued all tests in this suite have run.
@BeforeTest: The clarified technique will be keep running before any test strategy having a place with the classes inside the tag is run.
@AfterTest: The explained strategy will be pursued all the test strategies having a place with the classes inside the tag have run.
@BeforeGroups: The rundown of gatherings that this setup strategy will keep running some time recently. This strategy is ensured to run right away before the main test technique that has a place with any of these gatherings is conjured.
@AfterGroups: The rundown of gatherings that this setup technique will pursue. This strategy is ensured to pursue presently the last test technique that has a place with any of these gatherings is conjured.
@BeforeClass: The explained technique will be keep running before the principal test strategy in the present class is conjured.
@AfterClass: The explained technique will be pursued all the test strategies in the present class have been run.
@BeforeMethod: The explained technique will be keep running before each test strategy.
@AfterMethod: The explained technique will be pursued each test strategy.
@Test: The commented on strategy is a piece of an experiment.
Advantages of utilizing Annotations:
In any venture, you will wind up to a place where you have to execute such a large number of experiments on a run. Running an arrangement of experiments together is call executing a Test Suite. Those experiments can be needy to each other or may must be executed in a specific request. TestNg gives us the capacity to deal with our test execution.
TestNG Test Suite:
In TestNG system, we have to make testng.xml record to make and handle various test classes. This is the xml record where you will design your trial, set test reliance, incorporate or bar any test, technique, class or bundle and set need and so on.
Infocampus is a training institute that provides practical oriented selenium training in Bangalore with better job opportunities. It is a center where candidates will be practical oriented classes on each day. Flexible Batch timings for selenium course on both weekdays and weekends.
To get more information on best selenium training institute in Bangalore – INFOCAMPUS, then visit http://infocampus.co.in/best-selenium-testing-training-center-in-bangalore.html or call on 9738001024.
Like it? Share it!
About the AuthorInfocampus HR
Joined: December 10th, 2016
Articles Posted: 792
More by this author