有没有办法让 Robot Framework 按特定顺序运行测试套件? [英] Is there a way to get Robot Framework to run test suites in a certain order?

查看:96
本文介绍了有没有办法让 Robot Framework 按特定顺序运行测试套件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在本地目录下有 2 个测试套件,foo 和 bar,我想按照 foo 然后 bar 的顺序运行测试套件.

我尝试运行 pybot -s foo -s bar .,但它只是运行 bar 然后 foo(即按字母顺序).

有没有办法让 pybot 运行机器人框架套件,以便按照我定义的顺序执行?

解决方案

Robot 框架可以使用参数文件,可用于指定执行顺序(docs):

这是来自旧文档(不再在线):

<块引用>

参数文件的另一个重要用途是按特定顺序指定输入文件或目录.如果字母默认执行顺序不合适,这会非常有用:

基本上,您创建的内容类似于启动脚本.

--name 我的示例测试测试/some_tests.html测试/秒.html测试/更多/tests.html测试/更多/another.html测试/even_more_tests.html

有一个巧妙的功能,从参数文件你可以调用另一个可以覆盖先前设置的参数的参数文件.执行是递归的,因此您可以根据需要嵌套任意数量的参数文件

另一种选择是使用启动脚本.比您必须处理其他方面,例如您正在运行测试的操作系统.您还可以使用 python 在多个平台上启动脚本.文档

Suppose I have 2 test suites in the local directory, foo and bar, and I want to run the test suite in the order of foo then bar.

I tried to run pybot -s foo -s bar ., but then it just goes and run bar then foo (i.e. in alphabetical order).

Is there a way to get pybot to run robot framework suites to be execute in the order that I define?

解决方案

Robot framework can use argument files that can be used to specify order of execution (docs):

This is from older docs (not online anymore):

Another important usage for argument files is specifying input files or directories in certain order. This can be very useful if the alphabetical default execution order is not suitable:

Basically, you create something similar to start up script.

--name My Example Tests
tests/some_tests.html
tests/second.html
tests/more/tests.html
tests/more/another.html
tests/even_more_tests.html

There is neat feature that from argument file you can call another argument file that can override previously set parameters. Execution is recursive, so you can nest as many argument files as you need

Another option would be to use start up script. Than you have to deal with other aspects like which operating system you are running test on. You could also use python for starting up script on multiple platforms. There is more in this section of docs

这篇关于有没有办法让 Robot Framework 按特定顺序运行测试套件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆