SoapUI maven 中的源代码 [英] Source code in SoapUI maven

查看:43
本文介绍了SoapUI maven 中的源代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将我的源代码(java 代码)添加到 maven 运行的项目 SoapUI 中?我写了自己的断言类并在这个类中检查响应.首先,我制作了 dir ext 并将 .jar 文件放在那里.现在我想做同样的事情,但使用源代码.

How I can add my source code ( java code ) to project SoapUI running by maven? I wrote own assertion class and check response in this class. First i made dir ext and put there .jar file. Now I want do the same, but with source code.

推荐答案

通过在 \ext 文件夹中添加一个 jar,您使编译后的类可用于 SoapUI 测试运行器.取而代之的是,您可以将您的代码作为 maven 模块包含在您的项目中并将其添加为依赖项.您的 Java 代码应该是一个 Maven 项目才能使其正常工作.一种常见的方法是在项目的根目录中创建一个modules"目录,并将您的 java 代码添加到那里的子目录中,我们称之为assertion_module":

By adding a jar in the \ext folder you made the compiled class available to SoapUI test runner. Instead of that you could include your code as a maven module in your project and add it as dependency. Your Java code should be a maven project for this to work. 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":

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

文件夹中的 pom.xml 应设置必要的属性,如下所示(示例值):

The pom.xml in the folder should have the necessary properties set, like below (sample values):

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

在你掌握 pom.xml,即你用来运行 SoapUI 测试的那个声明你的断言模块,添加以下内容:

In you master pom.xml, i.e. the one that you use to run the SoapUI tests declare your assertion module, adding the following:

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

在这个pom的soapui插件部分添加必要的依赖部分:

In the soapui plugin section of this pom add the necessary dependency section:

<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>

现在,当您运行测试时,assertion_module 将被编译并可供 SoapUI 测试运行器使用.有了这个,您不再需要在 \ext 文件夹中添加编译的 jar,尽管您仍然需要在 \bin\ext 中添加它.

Now when you run your tests, the assertion_module will be compiled and be available to SoapUI test runner. 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.

这篇关于SoapUI maven 中的源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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