我的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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.cvent</groupId>
<artifactId>soa-readyapi</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>OnSite Solutions ReadyAPI Tests</name>
<properties>
<soapui.environment/>
<soapui.test-suite/>
<soapui.test-case/>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.smartbear</groupId>
<artifactId>ready-api-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<projectFile>${soapui.projectFile}</projectFile>
<iface>IOrderService</iface>
<tool>wsi,axis1,axis2</tool>
<settingsFile>soapui-settings.xml</settingsFile>
<!-- <environment>${soapui.environment}</environment> -->
<outputFolder>output</outputFolder>
<junitReport>true</junitReport>
<printReport>true</printReport>
<projectProperties>
<value>one_api="https://someurl:4000"</value>
<value>two_api="https://someurl:4001"</value>
<!-- <value>environment=${soapui.environment}</value> -->
</projectProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
当我尝试使用以下命令运行此项目时 -
mvn clean test -Dsoapui.projectFile=smokeTest
Run Code Online (Sandbox Code Playgroud)
测试似乎与ReadyAPI中设置的最后一个活动环境一起运行.它忽略了
<value>one_api="https://someurl:4000"</value>
<value>two_api="https://someurl:4001"</value>
Run Code Online (Sandbox Code Playgroud)
我知道我可以使用环境功能来做到这一点,但这对我当前的用例没有帮助.我想在运行时设置它,现在我正在硬编码pom.xml,看看它是否可行,但它没有.
关于为什么readyAPI忽略我在pom.xml中设置的值的任何想法?
谢谢
ReadyAPI'语义分析'错误.我已经将我的脚本库存储在bin文件夹中,我getBuildingInfo从ReadyAPI的groovy测试脚本中调用该方法.大多数时候这种方法工作正常,但有一段时间我得到了这个错误.我想找出确切的问题并找出根本原因.我在eclipse中测试了代码,它工作得非常好.
错误:BUG!源单元'Script15.groovy'阶段'语义分析'中的异常对PropertiesQuery的查找导致了失败的compilaton.这个电话不应该有任何汇编.BUG!源单元'Script15.groovy'阶段'语义分析'中的异常对PropertiesQuery的查找导致了失败的compilaton.这个电话不应该有任何汇编.
14:在静态范围内找到了表观变量"数据库",但没有引用局部变量,静态字段或类.可能的原因:您试图引用绑定中的变量或静态上下文中的实例变量.您错误拼写了一个类名或静态导入的字段.请检查拼写.您试图使用方法"数据库",但在语法不允许的位置省略括号.@第14行,第17列.def dbConn = Database.getDbConnection(env);
public class Database {
public static Connection getDbConnection (String env){
Connection conn = null;
Class.forName("com.mysql.jdbc.Driver")
switch (env){
case "TEST":
conn = DriverManager.getConnection("a","b","c")
break;
case "DEV":
conn = DriverManager.getConnection("a","b","d")
break;
}
return conn;
}
public static void closeDbConnection(Connection conn) {
conn.close();
}
}
class PropertiesQuery {
public static String getBuildingInfo(String env, String id, int row ){
String result = "111";
def query = "SELECT col1, col2 FROM tabl1 WHERE id = 1"
def …Run Code Online (Sandbox Code Playgroud) 我有下面的Groovy脚本,我需要将它放在集中的Groovy库中,然后从我的Ready API项目路径中的任何脚本访问Groovy中提到的类 :D:\ GroovyLib\com\Linos\readyapi\util\property\propertyvalidation
//Change the name of the Properties test step below
def step = context.testCase.testSteps['Properties']
//Parse the xml like you have in your script
def parsedXml = new XmlSlurper().parse(file)
//Get the all the error details from the response as map
def errorDetails = parsedXml.'**'.findAll { it.name() == 'IntegrationServiceErrorCode'}.inject([:]){map, entry -> map[entry.ErrorCode.text()] = entry.Description.text(); map }
log.info "Error details from response : ${errorDetails}"
def failureMessage = new StringBuffer()
//Loop thru properties of Property step and check against …Run Code Online (Sandbox Code Playgroud) 我有以下 Groovy 脚本,我试图在其中获取目录名和文件名:
File dir = new File("C://Users//avidCoder//Project")
log.info dir //Fetching the directory path
String fileName = "Demo_Data" + ".json"
log.info fileName //Fetching the file name
String fullpath = dir + "\\" + fileName
log.info fullpath //Fetching the full path gives error
Run Code Online (Sandbox Code Playgroud)
但是,当我运行它时,出现以下异常:
“java.io.File.plus() 适用于参数类型”
为什么创建fullpath变量会抛出这个异常?
是否有用于格式化 SoapUI XML 请求正文的键盘快捷键?我尝试过Alt+F哪个不起作用。
我刚刚开始使用ReadyAPI(SoapUI NG)为我们基于 Spring 的项目进行自动化测试。因此,使用 ReadyAPI 文档,我使用以下步骤成功测试了 REST URI 调用:
创建项目:文件 > 新建项目 > 使用 REST URI 创建项目
它创建一个如下所示的项目结构:REST Project > URI > createAccount < Request 1
在请求窗口中,我使用 xml/json 添加了参数。
运行请求后,我得到了我想要的响应。
我还检查了断言,它也给出了所需的结果。
我使用ReadyAPI 文档完成了这一切
我的问题如下:
如何使用ReadyAPI(SoapUI NG)实现自动化测试?
一般使用ReadAPI的哪些功能?如何有效地使用它们?
SoapUI NG、LoadUI NG、SoapUI、ReadyAPI 之间有什么区别?(我认为这些只是不同的版本,但不确定)
如何修剪(前导和尾随空格)SoapUI/ReadyAPI 断言部分中的变量?
Ex:
Input String : "Failure "
Output String : "Failure"
Run Code Online (Sandbox Code Playgroud)
我正在使用Soap UI来测试RESTFul webservices ..我已将[1,2,3,4,5 ....,10]存储在属性中作为PassedValue ..我必须将此值转换为Array或list. .so我可以获取每个索引值.
ExpectedValue = context.testCase.getPropertyValue("PassedValue") as String[]
Run Code Online (Sandbox Code Playgroud)
这不起作用..如果我打印ExpectedValue [0]它打印"["
我想将ExpectedValue [0]提取为1,将第一个索引提取为2 ..
试图转换为.toList但仍然没有运气..
任何人都可以帮我解决这个问题吗?
我在SoapUI中有两个单独的项目。我需要将属性从项目1转移到项目2。
同样,每次执行Project 2时,我都需要它在Project 1中运行一个测试用例,以获取更新的属性值。
项目1
项目二
我发现了一个Groovy脚本,它将从另一个项目中获取一个属性。
testRunner.getTestCase().getTestSuite().getProject.getWorkspace().getProjectByName(project name)
testSuite = project.getTestSuiteByName(suite_name);
testCase = testSuite.getTestCaseByName(testcase_name);
Run Code Online (Sandbox Code Playgroud)
但是我被困在如何使用Groovy脚本在另一个项目中运行测试用例
我收到以下错误消息:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script3.groovy: 1: unable to resolve class groovy.json.JsonSlurpe @ line 1, column 1. import groovy.json.JsonSlurpe ^
org.codehaus.groovy.syntax.SyntaxException: unable to resolve class groovy.json.JsonSlurpe @ line 1, column 1. at
org.codehaus.groovy.ast.ClassCodeVisitorSupport.addError(ClassCodeVisitorSupport.java:149) at
org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1225) at
org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:178) at
org.codehaus.groovy.control.CompilationUnit$11.call(CompilationUnit.java:651) at
org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:931) at
org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:593) at
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:542) at
Run Code Online (Sandbox Code Playgroud)