我已经用json为我的测试函数编写了一个配置文件。配置文件如下所示:
{
"Chrome_executable_path": "C:\\Users\\AIGHOSH\\PycharmProjects\\chromedriver.exe",
"File_locations": [["C:\\Users\\AIGHOSH\\Desktop\\DQ_DATA\\DimenLookupAge8277.csv"],
["C:\\Users\\AIGHOSH\\Desktop\\DQ_DATA\\DimenLookupAge8277.csv", "C:\\Users\\AIGHOSH\\Desktop\\DQ_DATA\\DimenLookupArea8277.csv"],
["C:\\Users\\AIGHOSH\\Desktop\\DQ_DATA\\DimenLookupAge8277.csv", "C:\\Users\\AIGHOSH\\Desktop\\DQ_DATA\\DimenLookupArea8277.csv", "C:\\Users\\AIGHOSH\\Desktop\\DQ_DATA\\DimenLookupEthnic8277.csv"],
["C:\\Users\\AIGHOSH\\Desktop\\DQ_DATA\\DimenLookupAge8277.csv", "C:\\Users\\AIGHOSH\\Desktop\\DQ_DATA\\DimenLookupArea8277.csv", "C:\\Users\\AIGHOSH\\Desktop\\DQ_DATA\\DimenLookupEthnic8277.csv", "C:\\Users\\AIGHOSH\\Desktop\\DQ_DATA\\DimenLookupSex8277.csv"],
["C:\\Users\\AIGHOSH\\Desktop\\DQ_DATA\\DimenLookupAge8277.csv", "C:\\Users\\AIGHOSH\\Desktop\\DQ_DATA\\DimenLookupArea8277.csv", "C:\\Users\\AIGHOSH\\Desktop\\DQ_DATA\\DimenLookupEthnic8277.csv", "C:\\Users\\AIGHOSH\\Desktop\\DQ_DATA\\DimenLookupSex8277.csv", "C:\\Users\\AIGHOSH\\Desktop\\DQ_DATA\\DimenLookupYear8277.csv"]
],
"Null_values": [["_"], ["@"], ["<>"], ["-"], ["#"]],
"Operation": [["None"], ["Append"], ["Merge"], ["Append then Merge"]],
"weights": [
{
"completeness": "0.2",
"timeliness": "0.2",
"uniqueness": "0.2",
"validity": "0.2",
"integrity": "0.2"
},
{
"completeness": "0.1",
"timeliness": "0.3",
"uniqueness": "0.2",
"validity": "0.2",
"integrity": "0.2"
},
{
"completeness": "0.2",
"timeliness": "0.2",
"uniqueness": "0.3",
"validity": "0.1",
"integrity": "0.2"
},
{
"completeness": "0.2",
"timeliness": "0.2",
"uniqueness": "0.1",
"validity": "0.4",
"integrity": "0.1"
},
{
"completeness": "0.1",
"timeliness": "0.1",
"uniqueness": "0.4",
"validity": "0.2",
"integrity": "0.2"
}
]
}
现在,我希望值[0]是我的第一个测试用例参数,然后v[1]是我的第二个测试用例参数
我的测试用例功能:
#for the fist element of the values(eg: v[0])
def test_case(self):
self.dqopenPage = DqOpenPage(self.driver)
self.dqopenPage.drop(filess = config["File_locations"]) #should take the first list with only 1 file
self.dqopenPage.df_operation(operation=config["Operations"]) #should take the "None"
self.dqopenPage.define_null_value(null = config["Null_values"])#should take "_"
因此,如何使用for循环获取值,并为所有相应的值(如v[1]、v[2]等)运行测试用例函数
解码json
使用所有索引-0参数进行测试,然后使用所有索引-1,…
对
testno = 0
进行1次测试(一次floc
,使用nv = "_"
和op = None
),然后对testno = 1
进行2次测试,依此类推使用每个参数排列进行测试
你得到了所有的5分!参数的可能排列
注意:为了测试这一点,我在“文件位置”中将
\\
替换为/
,以避免转义问题您可以像这样访问此处的各个值
如果希望通过循环访问单个值,可以这样做
这是循环文件位置的方法
这是通过空值或操作进行循环的方法
我不太明白你想循环浏览哪些列表,但我希望这对你有所帮助
相关问题 更多 >
编程相关推荐