SoapUI Groovy脚本:使用命令行创建新项目

时间:2017-10-03 23:22:46

标签: groovy soapui test-runner

我正在尝试使用groovy脚本创建Soapui项目。 当直接从SoapUI运行它时,脚本正常工作,并创建了带有WSDL的新项目。

脚本创建于:项目 - > TestSuite - > TestCase - > Groovy脚本

import com.eviware.soapui.impl.wsdl.*  
import com.eviware.soapui.impl.WsdlInterfaceFactory

String Release = "xxx.yyy";
String projectName = "Test_$Release" + ".xml";
String projectPath = "D:/work/";
String fullProjectPath = "$projectPath$projectName";
String pathToWSDL = "D:/work/AWSECommerceService.wsdl.xml";
log.info ("Release value is $Release");
log.info ("Projet path is $projectPath");
log.info ("Project name is $projectName");
log.info ("pathToWSDL $pathToWSDL");
log.info ("fullProjectPath $fullProjectPath");

def currentProject = testRunner.testCase.testSuite.project;

WsdlProject project = currentProject
                        .getWorkspace()
                        .createProject(projectName, new File(fullProjectPath));
 WsdlInterface iface = WsdlInterfaceFactory.importWsdl(project,pathToWSDL, true )[0]
context.testCase.testSuite.project.save("");

SoapUI开始,脚本正常运行。但是,使用testrunner.bat运行时失败,如下所示:

testrunner.bat "D:\Ivo\Project.xml"

返回以下错误:

  

错误:java.lang.NullPointerException:无法在null对象上调用方法createProject()

1 个答案:

答案 0 :(得分:1)

您可以尝试按以下方式进行更改:

发件人:

feature

feature