0

우리는 웹 서비스를 실행하는 데 SoapUI를 사용하고 있습니다. 이제 자동 회귀 테스트 프로젝트 (Java, Maven, Selenium Webdirver)를 작성합니다. SoapUI가 테스트 시작 또는 중간에 웹 서비스 요청을 보내려면 많은 테스트 스위트가 필요합니다. SoapUI 소스 코드를 가져 오거나 내 프로젝트에 SoapUI jars를 설치할 수있는 방법이 있는지 궁금합니다. 그래서 SoapUI 함수 나 메서드 또는 클래스를 직접 호출 할 수 있습니다. 는 내 pom.xml 파일에 이러한 종속성을 추가했습니다 :자동화 회귀 테스트 프로젝트에 SoapUI 호출/통합

<dependency> 
    <groupId>com.github.redfish4ktc.soapui</groupId> 
    <artifactId>maven-soapui-extension-plugin</artifactId> 
    <version>4.6.4.0</version> 
</dependency> 

<dependency> 
    <groupId>net.java.dev.jgoodies</groupId> 
    <artifactId>looks</artifactId> 
    <version>2.1.4</version> 
</dependency> 
<dependency> 
    <groupId>net.sf.squirrel-sql.thirdparty-non-maven</groupId> 
    <artifactId>com-fifesoft-rsyntaxtextarea</artifactId> 
    <version>1.0.0</version> 
</dependency> 
<dependency> 
    <groupId>org.apache.karaf.eik.plugins</groupId> 
    <artifactId>org.apache.commons.collections</artifactId> 
    <version>3.2.1</version> 
</dependency> 

I도 설치 SoapUI 인 IntelliJ 아이디어 플러그인. 그러나 아무것도 바뀌지 않은 것 같습니다. 도움과 조언을 해주셔서 감사합니다. 또는이 기능을 구현하기위한 다른 접근 방식이 있으면 좋을 것입니다.

+0

너무 광범위합니다. 구체적인 문제를 좁혀 야합니다. – Rao

+0

죄송합니다, 나는 단지 준비 작업이 무엇인지 알고 싶습니다. 그래서 soapUI 소스 코드의 메서드를 직접 사용할 수 있습니다. –

+0

@Rao와 동의 문서화부터 시작 하시겠습니까? https://www.soapui.org/test-automation/junit/junit-integration.html – SiKing

답변

0

가져 오기 모든 soapUi 항아리와 SoapUI.jar를 포함 <projectFile>sample-soapui-project.xml</projectFile> 을 변경해야합니다 : \의 Program Files (x86) \ SmartBear \ SoapUI-5.2.1 LIB 및 C \ : \ 프로그램 Files \ SmartBear \ SoapUI-5.2.1 \ bin.

public void runTestCase(String tarSuite, String tarCase) throws Exception { 

    String reportStr = ""; 

    SoapUI.setSoapUICore(new StandaloneSoapUICore(true)); 

    WsdlProject project = new WsdlProject("C:\\Users\\tshi\\Documents\\Maven Projects\\ASORT\\WebServiceResource\\Suncorp_Issuing-soapui-project.xml"); 

    List<TestSuite> suiteList = project.getTestSuiteList(); 

    for (TestSuite aSuiteList : suiteList) { 

     String suiteName = aSuiteList.getName(); 

     List<TestCase> caseList = aSuiteList.getTestCaseList(); 
     //System.out.println("Test Suite: " + suiteName); 

     if (suiteName.equals(tarSuite)) { 

      for (TestCase aCaseList : caseList) { 

       String caseName = aCaseList.getName(); 
       //System.out.println("Test Case: " + caseName); 

       if (caseName.equals(tarCase)) { 

        long startTime = System.currentTimeMillis(); 

        TestRunner runner = project.getTestSuiteByName(suiteName).getTestCaseByName(caseName).run(new PropertiesMap(), false); 

        long duration = System.currentTimeMillis() - startTime; 

        reportStr = reportStr + "\n\tTestCase: " + aCaseList.getName() + "\tStatus: " + runner.getStatus() + "\tReason: " + runner.getReason() + "\tDuration: " + duration; 

       } 

      } 

     } 

    } 

    System.out.print(reportStr); 

} 

이것은 목표를 달성하는 최선의 방법이 아닐 수 있습니다. 하지만 그것은 실제로 나를 위해 작동합니다. 모든 장치가 환영받을 것입니다. 다들 감사 해요.

-1

maven을 통해 soapUI를 실행하려고하는 것 같습니다. 그렇다면 pom.xml에 soapui-maven-pluginpluginRepository이 포함되어야합니다. 따라서 pom.xml은 아래처럼 보일 것입니다. HTML 형식 보고서를 얻으려면 maven-surefire-report-plugin도 포함됩니다. 당신은 C에서 프로젝트 파일

<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> 
    <groupId>com.test</groupId> 
    <artifactId>mytest</artifactId> 
    <packaging>jar</packaging> 
    <version>1.0-SNAPSHOT</version> 
    <name>mytest</name> 
    <url>http://maven.apache.org</url> 
    <dependencies> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>3.8.1</version> 
     <scope>test</scope> 
    </dependency> 
    </dependencies> 
    <pluginRepositories> 
    <pluginRepository> 
     <id>eviwarePluginRepository</id> 
     <url>http://www.eviware.com/repository/maven2/</url> 
    </pluginRepository> 
</pluginRepositories> 
<build> 
<plugins> 
    <plugin> 
    <groupId>com.smartbear.soapui</groupId> 
    <artifactId>soapui-maven-plugin</artifactId> 
    <version>5.1.2-m-SNAPSHOT</version> 
    <configuration> 
    <!--soapUI project file location--> 
    <projectFile>sample-soapui-project.xml</projectFile> 
    <!--output file location--> 
    <outputFolder>${project.basedir}/output/</outputFolder> 
    <!--junit results file--> 
    <junitReport>true</junitReport> 
    </configuration> 
    <executions> 
    <execution> 
     <id>soapUI</id> 
     <phase>test</phase> 
     <goals> 
     <goal>test</goal> 
     </goals> 
    </execution> 
    </executions> 
    </plugin> 
</plugins> 
</build> 
<reporting> 
    <plugins> 
     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-surefire-report-plugin</artifactId> 
     <version>2.18.1</version> 
     </plugin> 
    </plugins> 
    </reporting> 
</project> 
관련 문제