Robot Framework 三种测试用例模式
1、三种测试用例模式
关键字驱动(keyword-driver)、数据驱动(data-driver)、行为驱动模式(behavior-driver)
2、关键字驱动(keyword-driver)
![](http://upload-images.jianshu.io/upload_images/2054612-971b265e2716042e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
keyword-driver demo
![](http://upload-images.jianshu.io/upload_images/2054612-60f9ad4275d85bbe.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
result
3、数据驱动(data-driver)
3.1 new source->new keyword
![](http://upload-images.jianshu.io/upload_images/2054612-08ce044c65f52350.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
template keyworld
3.2 new testcase
![](http://upload-images.jianshu.io/upload_images/2054612-e51735d630c554bf.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
data-drive demo
![](http://upload-images.jianshu.io/upload_images/2054612-47699b2a8da7a0a1.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
result
在模板下有两个测试用例,这两个测试用例执行都是成功的,但是在rf的同级结果中只有1条的测试用例,如果以data-drive的模式进行测试,在模板下执行的测试存在fail的测试的用例,统计失败的用例就比较困难。
4、行为驱动模式(behavior-driver)
使用 Given-When-Then 模式的行为驱动开发(BDD)。
4.1 new source->new keyword
将参数写在关键字中。
![](http://upload-images.jianshu.io/upload_images/2054612-1c76f970a9b8c449.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
keyword
4.2 testcase
![](http://upload-images.jianshu.io/upload_images/2054612-cc632b8feb4da239.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
behavior-driver demo
![](http://upload-images.jianshu.io/upload_images/2054612-7a871c85b0342e8d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
作者:你说的啥呢
链接:http://www.jianshu.com/p/733849bda62c
來源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
本文来自博客园,作者:Yi个人,转载请注明原文链接:https://www.cnblogs.com/feifei-cyj/p/7739175.html