如何在SoapUI中定义一个全局类作为一个groovy脚本? [英] How to define a global class in SoapUI as a groovy script?

查看:134
本文介绍了如何在SoapUI中定义一个全局类作为一个groovy脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我试图在TestSuite属性中定义我的类。

我想在一个Groovy脚本中定义一个类,我可以通过SoapUI中的其他Groovy脚本重用。但它不起作用。 我想避免在JAR中定义类,因为我们在团队中工作,每个人都必须在他们的SoapUI中导入JAR以运行我的测试。我使用SoapUI 3.6.1



以下是我的TestSuite是如何制作的:

  TestSuite 
TestCase
TestSteps
Init(Groovy脚本)
GetResponse1(测试请求)
Test1(Groovy脚本)
GetResponse2(测试请求)$为了简化我的测试,我在'Test1'中定义了一个类,并且在Test1中定义了一个类。为了简化测试,我在'Test1'中定义了一个类,我想在'Test2'中重用这个类。所以理想情况下,我会在'Init'中定义这个类,并且它可以被任何其他groovy脚本访问。



我如何实现这一点?

解决方案

我很确定你将不得不创建一个JAR文件并将它放在\bin\ext中。



SoapUI会在重新启动时自动检测到它(您应该会在启动时看到它)。
$ b 您基本上只是创建一个Java或Groovy项目,导出(使用Eclipse),它会工作。 SoapUI可能会覆盖您的依赖关系,但如果没有,您可以添加这些JAR(比创建可运行的JAR更安全,因为SoapUI可能会使用您使用的不同版本)。



如果您需要帮助,请发布相关问题。


I want to define a class in a groovy script that i could reuse trough other groovy script inside SoapUI.

I alredy tried to define my class inside a TestSuite property but it doesn't work. I would like to avoid defining the class in a JAR because we work in team and every one would have to import the JAR in their SoapUI in order to run my tests. I use SoapUI 3.6.1

Here's how my TestSuite is made :

TestSuite
  TestCase
    TestSteps
       Init         (Groovy Script)
       GetResponse1 (Test Request)
       Test1        (Groovy Script)
       GetResponse2 (Test Request)
       Test2        (Groovy Script)

To simplify me tests, i defined a class in 'Test1' and i would like to reuse this class in 'Test2'. So ideally i would define that class in 'Init' and it would be accessible to any other groovy script.

How can i achieve that?

解决方案

I am pretty sure that you will have to create a JAR file and put it in \bin\ext.

SoapUI will automatically pick it up on restart (you should see it mentioned in the startup stuff).

You basically just create a Java or Groovy project, Export it (with Eclipse) and it will work. SoapUI will probably have your dependencies covered, but if not you can add those JARs too (safer than creating a runnable JAR since SoapUI might use different versions of what you use).

If you need help, post related questions.

这篇关于如何在SoapUI中定义一个全局类作为一个groovy脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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