TestNG Parameters & Data Provider in Selenium Webdriver

TestNG Parameters

The importance of Parameterization in trials and in automation screening. I operate a test circumstance many times with different insight and validation principles. As Selenium Webdriver an automated testing framework. when compared to a ready-to-use tool TestNG Parameters & Data Provider in Selenium Webdriver.

TestNG Parameters & Data Provider in Selenium Webdriver

The devote some effort to aid data driven screening in robotic tests. I usually opt to use Microsoft Excel as the format for holding my parameters. so many requested to create articles on TestNG Data Specialist.

TestNG again gives us another interesting feature called TestNG Guidelines. TestNG pass parameters right to test methods with testing.xml.

How to do it…

1) Generate a test on my demo OnlineStore application to execute LogIn. which calls for both string debate as username & security password.
2) Provide Username & Security password as the parameter using TestNG Annotation.

3) The parameter handed beliefs from testing.xml.

Now, run the testing.XML, which will run the parameter test method. TestNG will try to discover a parameter called username & password.

TestNG DataProviders

If want to pass complicated parameters or variables. that need to be created from Java, instances guidelines transferred using Data providers. A Data Specialist is a way annotated with @DataProvider. A Data Supplier returns a range of objects.

Let us browse the same Sign using Data providers.

How exactly to do it…

1) Define the method credentials() defined as a data provider using the annotation. This method returns the selection of object array.

2) Add a method test() to DataProviderTest course. This method requires two strings as source parameters.

3) Add the annotation @Test(data provider = “Authentication”) to this method. The attribute data provider mapped to “Authentication”.

TestNG Result

Run the test by right go through the test case script and choose Run As > TestNG Test. it completes the execution, finished the results can look such as this in the TestNG End result window.

 the test data provided two times, the mentioned test executed two times completely.

TestNG Parameters & Data Provider in Selenium Webdriver

 We provide TestNG Parameters & Data Provider in Selenium Webdriver training in real time. We offer project training for selenium training in hyderabad.



Leave a comment