我正在尝试从我的套件文件中删除 testng 参数,因为它们在多个套件中都需要。例如,我有 2 个测试套件,upgrades.xml
和 features.xml
。我创建了第三个文件,parameters.xml
我运行的实际套件文件如下所示:
<suite-files>
<suite-file path="parameters.xml" />
<suite-file path="features.xml" />
</suite-files>
features.xml
中的测试已运行,但由于配置错误而全部被跳过。如果我将我的参数直接粘贴到文件中,一切都会完美无缺。
最佳答案
我不相信您可以同时设置两个并行的套件,让一个套件访问另一个套件中的数据。 请试一试。
主.xml
<suite-files>
<suite-file path="features.xml" />
</suite-files>
特征.xml
...
<parameter name="config" value="parameters.xml"/>
...
但是您应该确保 parameters.xml 在您的应用程序中是可解析的。
关于testng - 如何在单独的套件文件中包含 TestNG 参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24126890/