8
A
回答
12
是的,它是可能的。在groovy步骤中,您可以访问testRunner,您可以使用它来访问soapUI中的其他所有内容,并且在另一个测试用例中运行测试步骤。
所以,这个代码是从上我的我的头......
def tCase = testRunner.testCase.testSuite.project.testSuites["Name of the other test suite"].testCases["name of test case you want to access"]
或
def tCase = testRunner.testCase.testSuite.testCases["Name of test cases"]
def tStep = tCase.testSteps["test step you want to run"]
tStep.run(testRunner, context)
看看这个link它可能有一定的帮助......
1
我意识到我对派对有点迟到,但是我想我会通过发布我的解决方案来解决类似问题来扩展这个话题。希望这有助于未来的人。解决方案可以扩展到覆盖两个以上的测试步骤,测试用例和/或项目。这也是我在这里的第一篇文章,所以请提前原谅我的任何noob错误。不是最漂亮的解决方案。它可能有一些冗余变量。所有代码块都包含整个解决方案。
问题:我想从两个不同的测试步骤中获取响应,每个测试步骤都在同一个工作区中的两个差异项目中进行。得到它了?大!
SOLUTION:
变量的第一个项目
String firstProjName = "Generic Project One"
String firstProjTestSuiteName= "Generic Test Suite Name One"
String firstProjTestCaseName = "Generic Test Case Name One"
String firstProjTestStepName= "Generic Test Step Name One"
变量第二个项目
String secondProjName= "Generic Project Two"
String secondProjTestSuiteName = "Generic Test Suite Name Two"
String secondProjTestCaseName= "Generic Test Case Name Two"
String secondProjTestStepName= "Generic Test Step Name Two"
访问通用测试步骤名称一
def firstProj= null
def workspace = testRunner.testCase.testSuite.project.getWorkspace();
firstProj= workspace.getProjectByName(firstProjName)
def firstTestCase = firstProj.testSuites[firstProjTestSuiteName].testCases[firstProjTestCaseName ]
def firstTestStep = firstTestCase.getTestStepByName(firstProjTestStepName)
运行一般测试步骤名一个
def runner = null
runner = firstTestStep.run(testRunner, context)
def firstTestStepResp = runner.getResponseContent()
runner = null
打印响应登录
log.info(firstTestStepResp)
同样的事情第二测试步骤
def secondProj= null
secondProj= workspace.getProjectByName(secondProjName)
def secondTestCase = secondProj.testSuites[secondProjTestSuiteName ].testCases[secondProjTestCaseName]
def secondTestStep = secondTestCase.getTestStepByName(secondProjTestStepName)
runner = secondTestStep.run(testRunner, context)
def secondTestStepResp = runner.getResponseContent()
log.info(secondTestStepResp)
我们现在有机会获得两种反应为字符串不管我们想要什么,我们都可以玩。比较,标记等。还有
getResponseContentAsXml()
如果响应是希望作为xml而不是字符串。
3
对于我们这些像我一样正在寻找当前版本的Ready!API
def testStep = testRunner.testCase.testSuite.project.getTestSuiteByName("[OTHER_TEST_SUITE_NAME]").getTestCaseByName("[OTHER_TEST_CASE_NAME]").getTestStepByName("[OTHER_TEST_STEP_NAME]")
testStep.run(testRunner, context)
相关问题
- 1. 贝哈特从测试步骤
- 2. 查询TFS2010测试用例无步骤
- 3. 如何在SoapUi中使用Groovy重命名测试用例或测试步骤
- 4. 如何导出测试案例与测试步骤从集会?
- 5. 测试时做出步骤
- 6. 如何在java中运行soapUi的特定测试步骤
- 7. SoapUI Groovy Script,log.info有关测试步骤运行的详细信息。
- 8. 使用Junit进行多步骤测试
- 9. SoapUI Groovy:检查测试步骤是否是肥皂请求
- 10. TFS 2015:将测试步骤添加到测试案例
- 11. Specflow中的继承测试步骤导致模糊步骤
- 12. 在测试步骤定义中定义外化的groovy文件
- 13. 如何使用groovy脚本在SoapUI中执行特定的测试步骤
- 14. Spring-Batch:测试步骤作用域步骤
- 15. 如何测试步骤跟踪器
- 16. 如何使用soapUI中的groovy删除测试步骤
- 17. 每次测试的测试设置和拆卸步骤
- 18. 如何测试Spring Batch中的单个步骤而不运行其他?
- 19. 如何测试服务功能需要运行的步骤?
- 20. 使用Groovy脚本循环遍历SOAP UI中的所有测试用例和测试步骤
- 21. 如何使用Groovy测试步骤在soapUI中设置Cookie?
- 22. 黄瓜PendingExceprion测试步骤在Intellij IDEA
- 23. 是否有测试版的步骤,然后这个循环
- 24. 使用python阅读Quality Center的特定测试步骤
- 25. 在azure中创建多步骤测试时出现错误应用程序洞察力多步骤测试
- 26. 在OSX上运行NUnit测试的步骤
- 27. 通过groovy在SOAPUI中跳过测试步骤
- 28. 测试未定义的步骤未标记为失败的测试
- 29. phpunit中登录认证测试用例的步骤laravel
- 30. 我们如何添加SOAP请求使用groovy脚本测试案例中的测试步骤