Data Driven Test using XML in JUnit Framework in WebDriver

Hi all,

I want to add Data Driven tests in JUnit Framework using the XML File in Web Driver.

Here is what I want to do. For example, – This class will have all methods to Parse  XML Data , Read Data. These methods will be Reusable, meaning any data-driven tests can extend and use it.

Test Script name =
Test XML File name = TestCreateLogin.XML.
(XML file will have data that will be used in Test Script “TestCreateLogin“.)

So, far I have a class – where I have written  Parse and Read Data methods. I am specifying an ‘TestCreateLogin.XML‘ file name in the test  by doing  the following:

File file = new File(“TestCreateLogin.xml”)

Since I am specifying the XML file name, this method is not Reusable by other Test Scripts.

#1. I am not sure how do I make this reusable ( I want to be able to specify an XML file name in such a way that other data-driven Test Scripts can use
May be like (*.xml)

#2. And also I am not sure how to  how to tell “ ” file to pick the parameters from the XML file.

Appreciate any helpful info.


Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.