将参数从 Eclipse 传递到 TestNG
我正在寻找一种在 TestNG 中执行测试方法的方法,这样当我单击 Eclipse 中的某个文件并执行 Run -> 时, TestNG,它将传递所选文件的全名,并且测试接收相同的文件名作为参数。
这可能与 TestNG 有关吗?我知道如何让 Eclipse 发送正确的参数,我不只是确定如何让 TestNG 接受它。
谢谢
I am looking for a way to do a test method in TestNG such that when I click in a certain file in Eclipse and make Run -> TestNG, it will pass that selected file's full name and the test receives that same file name as argument.
Is this possible to do with TestNG? I know how to make Eclipse send the correct argument, I am not just sure how to make TestNG accept it.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这有点 hacky...但您可以尝试从 Ant 实例化它。无需编写 build.xml,只需直接调用 testNG 任务 并为其提供类/文件名。这样所有的工作就为你完成了。我还相信 TestNG 在运行时需要它自己的 JVM,所以这也可以解决这个问题。
编辑:我想我误解了你的问题。
This is kind of hacky... but you could try instantiating it from Ant. Rather than write a build.xml just call the testNG task directly and feed it the class/file name. That way all the work is done for you. Also I believe that TestNG requires it's own JVM when it's running, so this will take care of that as well.
Edit: I think I misread your question.