简体   繁体   English

我们可以通过创建对象在Java程序中使用XML文件吗?

[英]Can we use XML file in a java program by creating object?

I have a XML file(Ex: testng.xml ) where I added all my test scripts in this XML file. 我有一个XML文件(例如: testng.xml ),我在其中添加了所有测试脚本。 I created a script where the login data is being pulled from excel file(Having three sets of login data). 我创建了一个脚本,其中从Excel文件中提取了登录数据(具有三组登录数据)。 Now I want to use this XML file in the Login data script where I want to run all the scripts in 3 accounts? 现在,我想在登录数据脚本中使用此XML文件,我想在其中运行3个帐户的所有脚本?

If you are using TestNG, then you dont need to create any xml objects to run the tests. 如果您使用的是TestNG,则无需创建任何xml对象即可运行测试。 Just check the TestNG official site on how to use TestNG tests. 只需查看有关如何使用TestNG测试的TestNG官方网站即可。 Also check the DataProviders topic in the same site on how to use test data for TestNG tests. 还要检查同一站点中的DataProviders主题,以了解如何将测试数据用于TestNG测试。

http://testng.org/doc/documentation-main.html http://testng.org/doc/documentation-main.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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