如何将soapUI与Jenkins集成?

Mic*_*ael 36 soap hudson soapui jenkins

有人知道在我的CI构建中添加soapUI测试的好方法吗?

Seb*_*ebi 31

soapUI通过Maven或Ant提供测试自动化.Maven集成在这里描述.

我在一个月前尝试过,但是eviware存储库有一些奇怪的问题......所以我现在通过Ant运行我的测试.您需要做的是调用soapUI bin目录中的testrunner.bat(或testrunner.sh)脚本.你可以在这里找到可用的参数.

您必须在Hudson构建服务器上安装soapUI.然后,您只需创建一个通过Ant构建的新作业.

样品build.xml:

<project name="IntegrationTest" default="soapui-tests" basedir=".">
    <description>Runs the soapUI integration tests</description>
    <property file="build.properties"/>

    <target name="checkos">
        <condition property="testrunner.cmd" value="${soapUI.home}/bin/testrunner.bat">
                <os family="windows" />
        </condition>
        <condition property="testrunner.cmd" value="${soapUI.home}/bin/testrunner.sh">
                <os family="unix" />
        </condition>
    </target>

    <target name="soapui-tests" depends="checkos">
        <exec executable="${testrunner.cmd}"
              failonerror="yes"
              failifexecutionfails="yes"
        >    
            <arg value="-e ${service.endpoint}"/>
            <arg value="-P dbUrl=${db.Url}"/>
            <arg value="-rajf"/>
            <arg path="${report.dir}"/>
            <arg path="${soapui.project.folder}"/>
        </exec>
    </target>
</project>
Run Code Online (Sandbox Code Playgroud)


小智 5

这很简单......

使用以下(示例)创建一个git repo:

??? pom.xml
??? RestAPI-negativeTestSuite.xml
??? RestAPI-positiveTestSuite.xml
Run Code Online (Sandbox Code Playgroud)

pom.xml,根据需要调整:

<project
        xmlns="http://maven.apache.org/POM/4.0.0" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <name>Test soapui</name>
    <groupId>tdrury</groupId>
    <artifactId>com.example.soapuitests</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <description>blah blah</description>
    <build>
        <plugins>
            <plugin>
                <groupId>com.smartbear.soapui</groupId>
                <artifactId>soapui-maven-plugin</artifactId>
                <version>5.0.0</version>

                <executions>
                    <execution>
                        <id>RestAPI-positiveTestSuite</id>
                        <configuration>
                            <projectFile>RestAPI-positiveTestSuite.xml</projectFile>
                            <outputFolder>target/surefire-reports</outputFolder>
                            <testSuite>Positive cases</testSuite>
                            <junitReport>true</junitReport>
                            <exportwAll>true</exportwAll>
                            <printReport>true</printReport>
                            <testFailIgnore>true</testFailIgnore>
                        </configuration>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <phase>test</phase>
                    </execution>

                    <execution>
                        <id>RestAPI-negativeTestSuite</id>
                        <configuration>
                            <projectFile>RestAPI-negativeTestSuite.xml</projectFile>
                            <outputFolder>target/surefire-reports</outputFolder>
                            <testSuite>Negative tests</testSuite>
                            <junitReport>true</junitReport>
                            <exportwAll>true</exportwAll>
                            <printReport>true</printReport>
                            <testFailIgnore>true</testFailIgnore>
                        </configuration>

                        <goals>
                            <goal>test</goal>
                        </goals>

                        <phase>test</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
Run Code Online (Sandbox Code Playgroud)

在Jenkins中创建一个新的Maven作业,并将其指向git repo和pom.xml,作为目标填写 test

这就是所有人