在python中进行仿真时无法正常工作

testurl = '{}/testplan/Plans/{}/Suites/{}/Testpoint?includePointDetails=true&api-version=5.1-preview.2'.format(base,planId,suiteId)

print(testurl)

while True:
    c = count_testpoints(testplanAPI(base,suiteId,callAPI(testurl)))
   if(c<200):
        break

其中callAPI()是一个函数,用于从响应中返回标头,该标头作为参数传递给testplanAPI(),以使用该参数作为URL参数来构建新的testurl。 testplanAPI()返回testurl,而count_testpoints()返回测试点的数量。

第一次计数少于200后,我必须关闭循环。

使用以上代码仅构建一次url,并无限迭代相同的条件。第一次迭代后,它不再追加URL。

能否请您提出一种更好的方法或在此处进行纠正?

liufei0225 回答:在python中进行仿真时无法正常工作

正如@deceze正确编写的那样,您必须在循环内设置url,最有可能必须保存新的基址和ID ...

while c < 200:
    testurl = '{}/testplan/Plans/{}/Suites/{}/Testpoint?includePointDetails=true&api-version=5.1-preview.2.format(base,planId,suiteId)'
    print(testurl)

    c = count_testpoints(testplanAPI(base,suiteId,callAPI(testurl)))
    # sth like: base,suiteId = new values for these...
本文链接:https://www.f2er.com/3153853.html

大家都在问