使用groovy运行测试套件和测试用例?(running a test suite and test case using groovy?)

编程入门 行业动态 更新时间:2024-10-25 22:37:15
使用groovy运行测试套件和测试用例?(running a test suite and test case using groovy?)

我有名为FirstTestSuite测试套件,然后创建了一个名为FirstTestCase的testCase。 我在soap UI中编写了一个groovy脚本,如下所示:

def tc = testRunner.testCase.testSuite.project.testSuites["FirstTestSuite"].testCases["FirstTestCase"]

在测试用例中,我有一个web方法,它创建一个带有一些数据的excel文件。 现在,当我运行脚本时,我没有调用web方法。 我是新手,所以我错过了剧本中的任何内容吗?

一旦我编写脚本,有一种方法可以使用crontab调用此脚本吗?

谢谢。

I have test suite with name FirstTestSuite and then created a testCase named FirstTestCase. I have written a groovy script in the soap UI like this:

def tc = testRunner.testCase.testSuite.project.testSuites["FirstTestSuite"].testCases["FirstTestCase"]

In the test case I have a web method which creates a excel file with some data. Now when I run the script the web method I not called. I am new to this so did I miss anything in the script?

Also once I write the script is there a way by which I can call this script using crontab?

Thanks.

最满意答案

您还没有编写运行测试用例执行的代码。 尝试使用此脚本:

//get test case from other project or from the same one project = testRunner.getTestCase().getTestSuite().getProject().getWorkspace().getProjectByName(project_name) testSuite = project.getTestSuiteByName(suite_name); testCase = testSuite.getTestCaseByName(testcase_name); //set properties if you need testRunner.testCase.setPropertyValue(property_name, property_value); testRunner.testCase.setPropertyValue(another_property_name, another_property_value); // run test case runner = testCase.run(new com.eviware.soapui.support.types.StringToObjectMap(), false);

还有一种使用crontab调用soap ui测试的方法。

使用soap ui testrunner.bat / .sh脚本中包含的命令行运行功能测试非常简单,该脚本需要许多参数来控制运行,输出哪些测试,例如:

sh SmartBear/soapUI-4.5.1/bin/testrunner.sh -s"TestSuite 1" -r -a -fyour_folder/reports your_folder/your_project-soapui-project.xml

哪里 SmartBear / soapUI-4.5.1 / bin / testrunner.sh:运行脚本的路径 -s“TestSuite 1”:测试套件名称 -r:在控制台中创建摘要报告 -a:在报告中导出所有测试结果,而不仅仅是错误 -fyour_folder / reports:报告文件夹的路径 your_folder / your_project-soapui-project.xml:soap ui项目文件的路径

更多信息请访问: http : //www.soapui.org/Test-Automation/functional-tests.html

在crontab中你只需要启动这个shell命令。

You haven't wrote the code which runs test case execution. Try to use this script:

//get test case from other project or from the same one project = testRunner.getTestCase().getTestSuite().getProject().getWorkspace().getProjectByName(project_name) testSuite = project.getTestSuiteByName(suite_name); testCase = testSuite.getTestCaseByName(testcase_name); //set properties if you need testRunner.testCase.setPropertyValue(property_name, property_value); testRunner.testCase.setPropertyValue(another_property_name, another_property_value); // run test case runner = testCase.run(new com.eviware.soapui.support.types.StringToObjectMap(), false);

Also there is a method to call soap ui tests using crontab.

Running functional tests from the command-line is straightforward using the included in soap ui testrunner.bat/.sh script, which takes a number of arguments to control which tests to run, output, for example:

sh SmartBear/soapUI-4.5.1/bin/testrunner.sh -s"TestSuite 1" -r -a -fyour_folder/reports your_folder/your_project-soapui-project.xml

where SmartBear/soapUI-4.5.1/bin/testrunner.sh : path to running script -s"TestSuite 1" : test suite name -r : create summary report in console -a : exporting of all test results in report, not only errors -fyour_folder/reports : path to your reports folder your_folder/your_project-soapui-project.xml : path to your soap ui project file

More information here: http://www.soapui.org/Test-Automation/functional-tests.html

And in crontab you just need to start this shell command.

更多推荐

本文发布于:2023-07-15 15:26:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1115323.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:测试   套件   groovy   running   case

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!