SoapUI Groovy 脚本:使用命令行创建新项目
SoapUI Groovy script: Create new project using command line
我正在尝试使用 groovy 脚本创建 Soapui 项目。
当 运行 直接从 SoapUI 连接它时,脚本工作正常,并创建了带有 WSDL 的新项目。
脚本创建于:Project -> TestSuite -> TestCase -> Groovy script
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"
返回以下错误:
Error:java.lang.NullPointerException: Cannot invoke method createProject() on null object
你能试试下面给出的改变吗:
发件人:
WsdlProject project = currentProject
.getWorkspace()
.createProject(projectName, new File(fullProjectPath));
收件人:
WsdlProject project = new WsdlProject();
project.setName(projectName);
//your statements goes here
//finally save project
project.saveAs(fullProjectPath);
我正在尝试使用 groovy 脚本创建 Soapui 项目。 当 运行 直接从 SoapUI 连接它时,脚本工作正常,并创建了带有 WSDL 的新项目。
脚本创建于:Project -> TestSuite -> TestCase -> Groovy script
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"
返回以下错误:
Error:java.lang.NullPointerException: Cannot invoke method createProject() on null object
你能试试下面给出的改变吗:
发件人:
WsdlProject project = currentProject
.getWorkspace()
.createProject(projectName, new File(fullProjectPath));
收件人:
WsdlProject project = new WsdlProject();
project.setName(projectName);
//your statements goes here
//finally save project
project.saveAs(fullProjectPath);