Cucumber 跨多个平台组织和运行机器人测试的最佳方法

Cucumber 跨多个平台组织和运行机器人测试的最佳方法,cucumber,robotframework,ui-automation,Cucumber,Robotframework,Ui Automation,这是新的。试图找出组织必须在多个平台上运行的测试的最佳方法是,有一个测试用例可以指向不同平台的关键字。标记在这个场景中是否起作用,这样我就可以用4个平台标记来标记一个特定的测试,并以某种方式将其配置为查看第一个标记并转到该标记/测试用例组合的相应关键字 因此,我可以使用以下示例测试用例并运行它4次,每个需要测试的平台各运行一次: 测试用例 Given I can log in to my application When I select the thing Then I see the oth

这是新的。试图找出组织必须在多个平台上运行的测试的最佳方法是,有一个测试用例可以指向不同平台的关键字。标记在这个场景中是否起作用,这样我就可以用4个平台标记来标记一个特定的测试,并以某种方式将其配置为查看第一个标记并转到该标记/测试用例组合的相应关键字

因此,我可以使用以下示例测试用例并运行它4次,每个需要测试的平台各运行一次:

测试用例

Given I can log in to my application
When I select the thing
Then I see the other thing
不必有4个单独的测试用例,每个平台一个,如:

Given I can log in to my application in native iOS app

Given I can log in to my application in native android app

Given I can log in to my application in native desktop app

Given I can log in to my application in native web app

这可能吗?

一个简单的解决方案是使用变量来标识要导入的平台特定库。例如,import语句可能如下所示:

*** Settings ***
Library  ${platform}Library.py
$ robot -v platform:IOS tests
$ robot -v platform:Android tests
然后,您可以创建名为IOSLibrary.pyAndroid.py等文件,然后按如下方式指定要加载的文件:

*** Settings ***
Library  ${platform}Library.py
$ robot -v platform:IOS tests
$ robot -v platform:Android tests

一个简单的解决方案是使用一个变量来标识要导入的特定于平台的库。例如,import语句可能如下所示:

*** Settings ***
Library  ${platform}Library.py
$ robot -v platform:IOS tests
$ robot -v platform:Android tests
然后,您可以创建名为IOSLibrary.pyAndroid.py等文件,然后按如下方式指定要加载的文件:

*** Settings ***
Library  ${platform}Library.py
$ robot -v platform:IOS tests
$ robot -v platform:Android tests