将参数传递到TestNG XML [英] Passing Parameters into a TestNG XML

查看:63
本文介绍了将参数传递到TestNG XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Maven与TestNG结合使用来运行自动化测试,并且对于每个测试/测试集,我目前都有一个单独的TestNG XML文件.我的问题是涉及可伸缩性.如何减少使用的TestNG XML文件的数量?

I'm using a combination of Maven with TestNG to run my automation tests and for each test/test set, I currently have a separate TestNG XML file for the same. My issue is when it comes to scalability. How can I reduce the number of TestNG XML files used?

通常,我的每个测试集都只有一个类.因此,我想知道有什么方法可以在执行对TestNG XML的测试调用时传递参数或其他方法来减少XML文件的数量.

Typically, each test set of mine has like only one class in it. So, I was wondering is there any way I can pass a parameter or something while executing the test call to the TestNG XML to reduce the number of XML files.

谢谢.

P.S.我不能合并多个测试并将它们分组在一个中,因为每个测试是通过另一个框架触发的.这些需要根据需要单独运行.也欢迎任何其他解决方案/建议.

P.S. I cant club multiple tests and group them in one as each tests are triggered via another framework. These needs to be ran separately upon requirement. Any other solutions/suggestions are also welcome.

推荐答案

找到了解决该问题的方法.我创建了一个接受参数的批处理文件,并根据传递给该批处理文件的输入参数,创建了我在运行时需要的TestNG xml,从而减少了TestNG Xml的数量.

Found a workaround for the same. I created a batch file to accept parameter and based on the input parameters passed to the batch file, it creates the TestNG xml i require on runtime and thereby reducing the number of TestNG Xml.

这篇关于将参数传递到TestNG XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆