selenium数据驱动

一安装ddt模块

打开cmd,输入pip install ddt

二准备测试数据

直接在程序里用list

testdata=[{"username":"test1","psw":"123456"},
{"username": "test2", "psw": "456789"},
{"username": "test3", "psw": "23456"}]

三测试类前加修饰

四case前加修饰

 

五运行

运行时自动加载3个用例,运行结果如下

 

posted @ 2017-06-13 14:47  chappy0  阅读(241)  评论(0编辑  收藏  举报