我正在尝试创建一个 TestCase,然后将附件添加到 TestCase。目前我可以成功创建一个TestCase,但是当我去添加附件时,我得到0个错误但没有添加附件。这是我的代码:
import sys, os
import datetime
from pyral import Rally, rallyWorkset, RallyRESTAPIError
def main():
rally = Rally("rally1.rallydev.com",
apikey="_myKey", workspace="myWorkspace",
project="myProject", verify_ssl_cert=False)
rally.enableLogging("rally.history.showstories")
query_criteria = 'FormattedID = "US622745"'
response = rally.get('UserStory', query=query_criteria, instance=True)
target_project = rally.getProject()
timen = datetime.datetime.now()
testcase_fields = {
"Project" : target_project.ref,
"WorkProduct" : response.ref,
"Name" : "Automated Test Generation -- " + str(timen),
"Method" : "Automated",
"Type" : "Acceptance"
}
testcase = rally.put('TestCase', testcase_fields)
print(testcase.details())
try:
attachment = rally.addAttachment(testcase.ref, "t2.txt")
except Exception as e:
print(str(e))
if __name__ == '__main__':
main()
sys.exit(0)
一切都按预期工作,直到 try 块。已为给定的用户故事成功创建了 TestCase,但添加附件不起作用,但出现 0 个错误。我必须做其他事情rally.addAttachment()
吗?文档对我来说真的很难阅读和理解。
attachment 是一个值为 False 的布尔值,即使文档指定它应该返回一个附件项。