Robot Framework 三种测试用例模式的demo

1、三种测试用例模式

关键字驱动(keyword-driver)、数据驱动(data-driver)、行为驱动模式(behavior-driver)

详见:测试用例模式

接下来的demo以百度的搜索为例子。

2、关键字驱动(keyword-driver)

Robot Framework 三种测试用例模式的demo_第1张图片
keyword-driver demo
Robot Framework 三种测试用例模式的demo_第2张图片
result

3、数据驱动(data-driver)

3.1 new source->new keyword

Robot Framework 三种测试用例模式的demo_第3张图片
template keyworld

3.2 new testcase

Robot Framework 三种测试用例模式的demo_第4张图片
data-drive demo


Robot Framework 三种测试用例模式的demo_第5张图片
result

在模板下有两个测试用例,这两个测试用例执行都是成功的,但是在rf的同级结果中只有1条的测试用例,如果以data-drive的模式进行测试,在模板下执行的测试存在fail的测试的用例,统计失败的用例就比较困难。

4、行为驱动模式(behavior-driver)

使用 Given-When-Then 模式的行为驱动开发(BDD)。

4.1 new source->new keyword

将参数写在关键字中。

Robot Framework 三种测试用例模式的demo_第6张图片
keyword

4.2 testcase

Robot Framework 三种测试用例模式的demo_第7张图片
behavior-driver demo
Robot Framework 三种测试用例模式的demo_第8张图片
result

你可能感兴趣的:(Robot Framework 三种测试用例模式的demo)