![](/img/trans.png)
[英]SoapUI NG Pro - Executing an UPDATE script in SoapUI using Groovy
[英]Execute JDBC teststep using Groovy in SOAPUI
我正在嘗試在 SOAPUI 中使用 Groovy 執行 JDBC teststep
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
請參閱下面的行以使用 cmd 運行您的soap 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"
參考您的評論,由於您的 groovy 腳本位於 project>testsuite>testCase 中,因此您無法在外部單獨觸發您的 groovy 腳本。 但是,您只能啟用 groovy 腳本並禁用所有其他測試步驟。 當您運行項目/測試用例時,您的 groovy 將執行並顯式調用其他步驟。 SOAPUI 不會自行運行禁用的步驟。
import com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext
def DBTestStep = ProjTestCase.getTestStepByName("Get_10_DBValues")
def runner = new WsdlTestRunContext(DBTestStep)
DBTestStep.run(testRunner, runner )
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.