简体   繁体   English

SoapUI Maven中的源代码

[英]Source code in SoapUI maven

How I can add my source code ( java code ) to project SoapUI running by maven? 我怎样才能将我的源代码(java代码)添加到由maven运行的项目SoapUI中? I wrote own assertion class and check response in this class. 我编写了自己的断言类,并在该类中检查响应。 First i made dir ext and put there .jar file. 首先,我做了dir ext并将其放在.jar文件中。 Now I want do the same, but with source code. 现在我想做同样的事情,但是要有源代码。

By adding a jar in the \\ext folder you made the compiled class available to SoapUI test runner. 通过在\\ext文件夹中添加一个jar,可以使编译后的类可用于SoapUI测试运行程序。 Instead of that you could include your code as a maven module in your project and add it as dependency. 取而代之的是,您可以将代码作为Maven模块包含在项目中,并将其添加为依赖项。 Your Java code should be a maven project for this to work. Java代码应该是一个行之有效的项目。 A common approach is to create a "modules" directory in your project's root and add your java code in a subdirectory there, let's call it "assertion_module": 一种常见的方法是在项目的根目录中创建一个“模块”目录,并将Java代码添加到该目录的子目录中,我们将其称为“ assertion_module”:

<root>
 | - soapui-project.xml
 | - pom.xml
 | - modules
      | - assertion_module
           | - src
           | - pom.xml

The pom.xml in the folder should have the necessary properties set, like below (sample values): 文件夹中的pom.xml应该设置必要的属性,如下所示(示例值):

<groupId>assertion_module</groupId>
<artifactId>assertion_module</artifactId>
<name>assertion_module</name>
<version>0.1</version>

In you master pom.xml , ie the one that you use to run the SoapUI tests declare your assertion module, adding the following: 在您的主pom.xml ,即用于运行SoapUI测试的那个声明您的断言模块,并添加以下内容:

<modules>
    <module>modules/assertion_module</module>
</modules>

In the soapui plugin section of this pom add the necessary dependency section: 在此pom的soapui插件部分中,添加必要的依赖项部分:

<plugin>
    <groupId>com.smartbear.soapui</groupId>
    <artifactId>soapui-maven-plugin</artifactId>
    <version>5.1.2</version>

    <dependencies>
        <dependency>
            <groupId>assertion_module</groupId>
            <artifactId>assertion_module</artifactId>
            <version>0.1</version>
        </dependency>
    </dependencies>

    ...
</plugin>

Now when you run your tests, the assertion_module will be compiled and be available to SoapUI test runner. 现在,当您运行测试时,assertion_module将被编译并可供SoapUI测试运行器使用。 With this you no longer need to add the compiled jar in the \\ext folder, although you still need to have it in the <SoapUI_installtion_directory>\\bin\\ext . 这样,您就不再需要将已编译的jar添加到\\ext文件夹中,尽管您仍然需要将其保存在<SoapUI_installtion_directory>\\bin\\ext

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

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