【问题标题】:Execute JDBC teststep using Groovy in SOAPUI在 SOAPUI 中使用 Groovy 执行 JDBC 测试步骤
【发布时间】:2017-03-31 10:41:03
【问题描述】:

我正在尝试在 SOAPUI 中使用 Groovy 执行 JDBC 测试步骤

def Proj = null
def workspace = testRunner.testCase.testSuite.project.getWorkspace();
Proj= workspace.getProjectByName("<ProjectName>")   
def ProjTestCase = Proj.testSuites["["<TestSuiteName>"].testCases["
<TestCaseName>"]
def DBTestStep = ProjTestCase.getTestStepByName("Get_10_DBValues")
def runner = null
runner = DBTestStep.run(testRunner, context)
log.info(DBTestStep)
runner = null

我给了我以下输出 信息:com.eviware.soapui.impl.wsdl.teststeps.JdbcRequestTestStep@7f34840b

【问题讨论】:

  • 你试过定义JDBC Test Step吗?
  • @Rao,感谢您的回复。我能够开始工作......我还有一个问题,如何从命令行只运行一个 groovy 脚本(我的脚本包含要执行的测试用例)......?
  • 您可以使用 SOAPUI_HOME/bin/testrunner.bat 或 .sh 来运行命令行。
  • 我只想运行一个脚本(我的脚本将在一个测试用例中执行所有测试步骤),怎么能提到从命令行只执行一个 groovy 脚本?

标签: jdbc groovy soapui


【解决方案1】:

请参阅下面的行以使用 cmd 运行您的肥皂 UI 项目或存储到批处理文件中并运行批处理文件

cd C:\Users\%username%\SmartBear\SoapUI-Pro-5.1.2\bin\

cmd.exe /C testrunner.bat -a -j -f"<localPathForReportStoring>" -R"JUnit-Style HTML Report" -EDefault "<LocalPath>\ProjectName.xml"

【讨论】:

    【解决方案2】:

    参考您的评论, 由于您的 groovy 脚本位于 project>testsuite>testCase 中,因此您不能单独从外部触发您的 groovy 脚本。 但是,您只能启用 groovy 脚本并禁用所有其他测试步骤。 当您运行项目/测试用例时,您的 groovy 将执行并显式调用其他步骤。 SOAPUI 不会自行运行禁用的步骤。

    【讨论】:

      【解决方案3】:
      import com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext
      def DBTestStep = ProjTestCase.getTestStepByName("Get_10_DBValues")
      def runner =  new WsdlTestRunContext(DBTestStep)
      DBTestStep.run(testRunner, runner )
      

      【讨论】:

      • 如果您解释了您提供的代码如何回答问题,这将是一个更好的答案。
      猜你喜欢
      • 2018-05-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多