2

我正在尝试从 Rally 工具中获取测试计划详细信息。我们有用户故事、缺陷、发布参数来获取相应的数据。我想了解如何通过 python pyral API 从集会中获取测试计划

4

1 回答 1

0

这对我有用...

$ cat -n tf.py
 1  import sys
 2  import re
 3
 4  if sys.version_info[0] < 3:
 5      print ("ERROR: This script is using Python version %s" % (sys.version_info[0]))
 6      print ("       It must be using Python 3 or greater")
 7      exit(-1)
 8
 9  from pyral import Rally, rallyWorkset
10
11  options = [arg for arg in sys.argv[1:] if arg.startswith('--')]
12  args    = [arg for arg in sys.argv[1:] if arg not in options]
13  server, user, password, apikey, workspace, project = rallyWorkset(options)
14
15  print("Using Python version '%s'" % sys.version_info[0])
16  print("Connecting to Rally with options:")
17  print("\t   server: %s" % server)
18  print("\t     user: %s" % user)
19  hidden_apikey = apikey[:4] + re.sub(".",".",apikey[4:-4]) + apikey[-4:]
20  print("\t   apikey: %s" % hidden_apikey)
21  print("\tworkspace: %s" % workspace)
22  print("\t  project: %s" % project)
23
24  rally = Rally(server, user, password, apikey, workspace=workspace, project=project)
25
26  testfolders = rally.get('TestFolder', fetch=True, query='')
27  folders_found = testfolders.resultCount
28  print ("TestFolders found: %s" % folders_found)
29
30  for folder_index,folder in enumerate(testfolders, start=1):
31      print ("\ttestfolder (%s of %s): FormattedID=%s  ObjectID=%s  Name='%s'" %
32          (folder_index, folders_found, folder.FormattedID,folder.ObjectID,folder.Name))

命令行:

$ python ./tf.py --user=wiley.com@acme.com  --password=coyote  --workspace=WS-test  --project='Sample'

输出:

Using Python version '3'
Connecting to Rally with options:
       server: rally1.rallydev.com
         user: wiley@acme.com
    workspace: WS-test
      project: Sample
TestFolders found: 2
  testfolder (1 of 2): FormattedID=TF1  ObjectID=229499794780  Name='JP 1st TestFolder'
  testfolder (2 of 2): FormattedID=TF3  ObjectID=289446576888  Name='JP 2nd TestFolder'
于 2019-02-21T20:54:42.260 回答