当前位置: 首页>>代码示例>>Python>>正文


Python TestLinkHelper.connect方法代码示例

本文整理汇总了Python中testlink.TestLinkHelper.connect方法的典型用法代码示例。如果您正苦于以下问题:Python TestLinkHelper.connect方法的具体用法?Python TestLinkHelper.connect怎么用?Python TestLinkHelper.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在testlink.TestLinkHelper的用法示例。


在下文中一共展示了TestLinkHelper.connect方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import connect [as 别名]
def main(config_module=None):
    from testlinktool.main.config import TESTLINK_SERVER, TESTLINK_PROJECT_ID, TESTLINK_PROJECT_NAME,\
                                         TESTLINK_API_KEY, CUSTOM_FIELD_NAME_LIST, UI_TEST_KEYWORD

    # use configuration
    try:
        if config_module is not None:
            TESTLINK_SERVER = getattr(config_module, "TESTLINK_SERVER")
            TESTLINK_PROJECT_ID = getattr(config_module, "TESTLINK_PROJECT_ID")
            TESTLINK_PROJECT_NAME = getattr(config_module, "TESTLINK_PROJECT_NAME")
            TESTLINK_API_KEY = getattr(config_module, "TESTLINK_API_KEY")
            CUSTOM_FIELD_NAME_LIST = getattr(config_module, "CUSTOM_FIELD_NAME_LIST")
            UI_TEST_KEYWORD = getattr(config_module, "UI_TEST_KEYWORD")
        elif exists(join(getcwd(), 'config.json')):
            with open(join(getcwd(), 'config.json')) as j_file:
                conf_dic = json_read_file(j_file)
                TESTLINK_SERVER = conf_dic["TESTLINK_SERVER"]
                TESTLINK_PROJECT_ID = conf_dic["TESTLINK_PROJECT_ID"]
                TESTLINK_PROJECT_NAME = conf_dic["TESTLINK_PROJECT_NAME"]
                TESTLINK_API_KEY = conf_dic["TESTLINK_API_KEY"]
                CUSTOM_FIELD_NAME_LIST = conf_dic["CUSTOM_FIELD_NAME_LIST"]
                UI_TEST_KEYWORD = conf_dic["UI_TEST_KEYWORD"]
    except ImportError:
        print("Warning we are using default parameters")
    parser = argparse.ArgumentParser(description='')
    group = parser.add_argument_group()
    group.add_argument('-d', '--test-dir', dest='dest_dir',
                       help="The directory path where generated tests will be sent (defaults to 'tests')",
                       default="tests")
    group.add_argument('-p', '--plan', dest='plan', help="the test plan", default=None, required=True)
    group.add_argument('-a', '--download-all', dest='download_all', default=False, action="store_true",
                       help="if used will download all tests, even those which are already coded")
    group.add_argument('-v', '--verbose', dest='verbose', default=False, action="store_true",
                       help="verbosity")
    
    args = parser.parse_args()

    tl_helper = TestLinkHelper(TESTLINK_SERVER, TESTLINK_API_KEY)
    testlink_client = tl_helper.connect(TestlinkAPIClient)
    plan_id = int(testlink_client.getTestPlanByName(TESTLINK_PROJECT_NAME, args.plan)[0]['id'])
    suites = testlink_client.getTestSuitesForTestPlan(plan_id)
    # build a id/name relation dictionary
    suites_tc_dic = {
        suite["id"]: suite["name"] for suite in suites
    }
    cases = get_tests(testlink_client, UI_TEST_KEYWORD, plan_id, TESTLINK_PROJECT_ID, CUSTOM_FIELD_NAME_LIST)
    names = [n["tcase_name"] for n in cases]
    other_cases = get_tests(testlink_client, None, plan_id, TESTLINK_PROJECT_ID, CUSTOM_FIELD_NAME_LIST)
    cases += [n for n in other_cases if n["tcase_name"] not in names]
    for case in cases:
        case["suite"] = suites_tc_dic[case["testsuite_id"]]

    tests = []
    # if we do not force to download everythin we get already defined tests to avoid erasing them
    if not args.download_all:
        tests += list(set([a for a in get_test_names(defaultTestLoader.discover(args.dest_dir))]))
    # launch true creation
    for to_be_created in cases:
        if to_be_created["tcase_name"] not in tests:
            create_test_file(to_be_created, args.dest_dir, to_be_created["keyword"] == UI_TEST_KEYWORD, args.plan)
开发者ID:dcolam,项目名称:test-automation-framework,代码行数:62,代码来源:generate_test.py

示例2: afterEditing

# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import connect [as 别名]
 def afterEditing(self):
     self.parentApp.host = self.hostBox.value
     self.parentApp.devkey = self.devkeyBox.value
     try:
         self.statusBox.value = 'Connecting...'
         tlh = TestLinkHelper(server_url='http://'+self.parentApp.host+'/lib/api/xmlrpc/v1/xmlrpc.php', devkey=self.parentApp.devkey)
         self.parentApp.tl = tlh.connect(TestlinkAPIClient)
         self.parentApp.tl.sayHello()
     except testlinkerrors.TLConnectionError as err:
         self.statusBox.value = err
     else:
         self.parentApp.setNextForm('IMPORT')
开发者ID:galen-elfert,项目名称:TLimport,代码行数:14,代码来源:TLimport.py

示例3: __init__

# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import connect [as 别名]
 def __init__(self, server_url, project_id,
              platformname, must_create_build,
              testlink_key, verbose=False, generate_xml=False):
     self.server_url = server_url
     self.generate_xml = generate_xml
     self.project_id = project_id
     self.platformname = platformname
     self.must_create_build = must_create_build
     self.testlink_key = testlink_key
     tl_helper = TestLinkHelper(self.server_url, self.testlink_key)
     self.testlink_client = tl_helper.connect(TestlinkAPIClient)
     self.plans = self.testlink_client.getProjectTestPlans(self.project_id)
     self.verbose = verbose
开发者ID:artragis,项目名称:test-automation-framework,代码行数:15,代码来源:TestLinkReport.py

示例4: create_api_client

# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import connect [as 别名]
    def create_api_client(self, client_class='TestlinkAPIClient', 
                          server_url=None, devkey=None):
        """Creates a new TestLink-API-Python-client (XMLRPC), using Python class 
        TestlinkAPIClient or TestlinkAPIGeneric. 
        """

        a_server_url  = server_url or self._server_url
        a_devkey      = devkey or self._devkey
        a_helper = TestLinkHelper(a_server_url, a_devkey)
        
        a_class_name  = client_class or self._client_class
        a_api_class   = globals()[a_class_name]
        self.api_client  = a_helper.connect(a_api_class)
        return self.api_client 
开发者ID:Maberi,项目名称:TestLink-API-Python-client,代码行数:16,代码来源:TestlinkAPILibrary.py

示例5: TestLinkHelper

# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import connect [as 别名]
# 
# alternative precondition b)
# SERVEUR_URL and KEY are defined as command line arguments
# python TestLinkExample.py --server_url http://YOURSERVER/testlink/lib/api/xmlrpc.php
#                           --devKey 7ec252ab966ce88fd92c25d08635672b
#
# ATTENTION: With TestLink 1.9.7, cause of the new REST API, the SERVER_URL 
#            has changed from 
#               (old) http://YOURSERVER/testlink/lib/api/xmlrpc.php
#            to
#               (new) http://YOURSERVER/testlink/lib/api/xmlrpc/v1/xmlrpc.php
tl_helper = TestLinkHelper()
tl_helper.setParamsFromArgs('''Shows how to use the TestLinkAPI.
=> Counts and lists the Projects 
=> Create a new Project with the following structure:''')
myTestLink = tl_helper.connect(TestlinkAPIGeneric) 

myPyVersion = python_version()
myPyVersionShort = myPyVersion.replace('.', '')[:2]

NEWTESTPLAN_A="TestPlan_API_GENERIC A"
NEWTESTPLAN_B="TestPlan_API_GENERIC B"
NEWTESTPLAN_C="TestPlan_API_GENERIC C - DeleteTest"
NEWPLATFORM_A='Big Bird %s' % myPyVersionShort
NEWPLATFORM_B='Small Bird'
NEWPLATFORM_C='Ugly Bird'
NEWTESTSUITE_A="A - First Level"
NEWTESTSUITE_B="B - First Level"
NEWTESTSUITE_AA="AA - Second Level"
NEWTESTCASE_AA="TESTCASE_AA"
NEWTESTCASE_B="TESTCASE_B"
开发者ID:TommyXie1990,项目名称:TestLink-API-Python-client,代码行数:33,代码来源:TestLinkExampleGenericApi.py

示例6: TestLinkHelper

# 需要导入模块: from testlink import TestLinkHelper [as 别名]
# 或者: from testlink.TestLinkHelper import connect [as 别名]
# 
# alternative precondition b)
# SERVEUR_URL and KEY are defined as command line arguments
# python TestLinkExample.py --server_url http://YOURSERVER/testlink/lib/api/xmlrpc.php
#                           --devKey 7ec252ab966ce88fd92c25d08635672b
#
# ATTENTION: With TestLink 1.9.7, cause of the new REST API, the SERVER_URL 
#            has changed from 
#               (old) http://YOURSERVER/testlink/lib/api/xmlrpc.php
#            to
#               (new) http://YOURSERVER/testlink/lib/api/xmlrpc/v1/xmlrpc.php
tl_helper = TestLinkHelper()
tl_helper.setParamsFromArgs('''Shows how to use the TestLinkAPI.
=> Counts and lists the Projects 
=> Create a new Project with the following structure:''')
myTestLink = tl_helper.connect(TestlinkAPIClient) 

myPyVersion = python_version()
myPyVersionShort = myPyVersion.replace('.', '')[:2]

NEWTESTPLAN_A="TestPlan_API A"
NEWTESTPLAN_B="TestPlan_API B"
NEWTESTPLAN_C="TestPlan_API C - DeleteTest"
NEWTESTPLAN_G="TestPlan_API G - generated"
NEWPLATFORM_A='Big Birds %s' % myPyVersionShort
NEWPLATFORM_B='Small Birds'
NEWPLATFORM_C='Ugly Birds'
NEWPLATFORM_G='generated Birds'
NEWTESTSUITE_A="A - First Level"
NEWTESTSUITE_B="B - First Level"
NEWTESTSUITE_AA="AA - Second Level"
开发者ID:TommyXie1990,项目名称:TestLink-API-Python-client,代码行数:33,代码来源:TestLinkExample.py


注:本文中的testlink.TestLinkHelper.connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。