简体   繁体   中英

Can we retrieve XML data into DataProviders in TestNG? if so how?

I have an XML file with data of popup information. I need to retrieve them one by one and use it in my test method in Java. I am using selenium RC.

XML file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<windows listsize="4"> 
<popups>
    <win>
             <title>exact:What List?</title>
         <val>28</val>        
    </win>  
</popups>
</windows> 

Note: it would be great if the response is in java.

Please help.

This is more a question about XML than it is about TestNG, but just look up "Java XML" and you'll find tons of parsers and libraries to help you do that. Once you have parsed that information, return it from your data provider.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM